ok so I implemented your suggestions and now the code starts to act in ways that I can not understand. My code now looks like this:Ah, I mixed up multiple suggestions. The flush=True one was for externally-triggered Raspberry Pi, rather than externally-triggered camera -- you would have had to add code to detect a trigger signal coming into the Raspberry Pi GPIO, while the camera was running continuously (i.e. not in trigger mode). I suggested it because you'd mentioned taking frames from a constant stream.
That option ought to be harmless with an externally-triggered camera as well (unless it's triggered very quickly). But try without the flush=True
EDIT: I just tried your code. Try adding this line at the end:You should get more frames now.Code:
frame.release()
EDIT2: To get the very first frame: you can disable AEC/AGC, AWB by putting this line before start():or something similar.Code:
picam2.set_controls({"ExposureTime": 10000, "AnalogueGain": 1.0, "ColourGains": (1.5,2)})
Even if you prefer to keep AGC and AWB you should fix the nominal exposure time, as exposure is controlled by the external source.
Code:
from picamera2 import Picamera2import os, sys, cv2import libcamerawidth = 640height = 480picam2 = Picamera2()picam2.preview_configuration.main.size = (width, height)picam2.preview_configuration.main.format = "RGB888"picam2.preview_configuration.align()picam2.configure("preview")picam2.set_controls({"ExposureTime": 10000, "AnalogueGain": 1.0, "ColourGains": (1.5,2), "FrameRate": 60})picam2.start()while True:frame = picam2.capture_request()if(frame is not None):print("Show image")frame.release()Code:
flush=TrueCode:
frame.release()Statistics: Posted by Aipathon — Tue Jul 01, 2025 12:22 pm