Quantcast
Viewing all articles
Browse latest Browse all 4867

Camera board • Re: synchronously capture images by two triggered GS cameras

Thanks for your answer.

I've conducted a test where I captured short videos, each lasting 1 second, from both cameras using libcamera-vid. Afterwards, I split these videos into individual images using ffmpeg

Code:

libcamera-vid --camera 0 --timeout 1000 --framerate 60 --shutter 5000 --output /cam0.mp4 & libcamera-vid --camera 1 --timeout 1000 --framerate 60 --shutter 5000 --output /cam1.mp4
When the --shutter value matched the value of the 'shutter' variable from the MicroPython code provided in the documentation, I achieved synchronized pictures.
https://github.com/raspberrypi/document ... igger.adoc

However, upon splitting the videos into frames using picamera2 and the code below:

Code:

from picamera2 import Picamera2, Previewfrom picamera2.encoders import H264Encoderfrom picamera2.outputs import FfmpegOutputcam1 = Picamera2(0)video_config1= cam1.create_video_configuration(controls={"FrameDurationLimits": (16667, 16667), "ExposureTime": 5000})cam1.configure(video_config1)encoder1 = H264Encoder(10000000)output1 = FfmpegOutput('/path/testcam0.mp4')cam2 = Picamera2(1)video_config2 = cam2.create_video_configuration(controls={"FrameDurationLimits": (16667, 16667), "ExposureTime": 5000})cam2.configure(video_config2)encoder2= H264Encoder(10000000)output2 = FfmpegOutput('/path/testcam1.mp4')cam1.start_recording(encoder1, output1)cam2.start_recording(encoder2, output2)time.sleep(1)cam2.stop_recording()cam1.stop_recording()cam2.stop()cam1.stop()
I got an issue where the number of images obtained for testcam0.mp4 and testcam1.mp4 did not match, and consequently, the frames were not synchronized.

So I achieved synchronized camera capture, but only using libcamera-vid.

For my application I need to capture frames from both cameras in real-time and perform preprocessing tasks like mixing or subtracting images. Do you have any suggestions on how I can achieve this while keeping the cameras synchronized?

Thank you.

Statistics: Posted by Raccoon987 — Sun Mar 24, 2024 7:29 pm



Viewing all articles
Browse latest Browse all 4867

Trending Articles