Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8082

Camera board • Re: How to receive the Images created by an external trigger of the GS camera

$
0
0
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:

Code:

frame.release()
You should get more frames now.

EDIT2: To get the very first frame: you can disable AEC/AGC, AWB by putting this line before start():

Code:

picam2.set_controls({"ExposureTime": 10000, "AnalogueGain": 1.0, "ColourGains": (1.5,2)})
or something similar.
Even if you prefer to keep AGC and AWB you should fix the nominal exposure time, as exposure is controlled by the external source.
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:

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()
If I execute it, the script constantly captures images and triggers the if part. This is weird, since I do not pulse the camera. This also occurs if I add

Code:

flush=True
. if I remove

Code:

frame.release()
(which is in the if part and shouldnt be executed at all) it only captures the first few frames caused by setting the AGC and AWB (even tho it should be turned off). What the hell happened here and how do I get it to work the way I want it to work.

Statistics: Posted by Aipathon — Tue Jul 01, 2025 12:22 pm



Viewing all articles
Browse latest Browse all 8082

Trending Articles