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

Camera board • Re: Synchronization to achieve real-time video (or timestamps) on RPi 5 + HQ/Camera 3

$
0
0
It sounds like you're getting the wrong camera mode. To cut a long story short, the camera system doesn't know what's most import to you, the image resolution, the field of view, the bit depth of the samples, or the maximum framerate, and it can easily make the wrong assumption. The solution is simply to say what camera mode you want. First, type this:

Code:

rpicam-hello --list-cameras
which will list all the available modes. For the IMX477 you should see a 1332x990 mode, which IIRC is 10 bit. The way to force selection of this sensor mode would be

Code:

main = {'size': (1332, 990)}controls = {"FrameDurationLimits": (8333, 8333)}  # 120 FPS = 8333 microseconds per framesensor = {'output_size': (1332, 990), 'bit_depth': 10}video_config = picam2.create_video_configuration(main, sensor=sensor, controls=controls)
High framerates can be challenging in Python. A simple "while" loop is not guaranteed to see every frame, or even every frame that gets encoded (if that's what you're doing). If you put some code into Picamera2's pre_callback, that _is_ guaranteed to see every frame that gets encoded (because the callback runs in the camera event loop), but there are never guarantees about not missing any frames at all.

To avoid missing frames: try not to be doing much else on the Pi, especially in your Python process. Don't use a preview window as this will slow it up significantly. Make sure you allocate a high enough buffer count. Don't use larger images than you need. Avoid the most hungry memory formats - YUV420 is much better than 24-bit RGB which is better than 32-bit ARGB. (Unfortunately Python support for YUV420 is pretty limited, and GPU support non-existent for 24-bit RGB, so ARGB - the single worst memory format - is often the default.)

Statistics: Posted by therealdavidp — Thu Oct 24, 2024 8:12 am



Viewing all articles
Browse latest Browse all 5083

Trending Articles