Hello,
I'm noticing some odd behavior with my camera module v 3 and libcamerify in that the dimensions of my frame captures in OpenCV 4.11 are very incorrect. For example, if I request a 320x240 pixel image and I try to convert the frame capture to jpeg it will fail because the dimensions are larger than what the jpeg file format can support. If I output to a tiff instead I get a 460800x1 pixel image.
Attempt with jpegI can take a picture without libcamerify using rpicam-still, but for an application I'm wanting to directly access the camera in OpenCV Python.
If I take out libcamerify, I can't read a framePrints this warningRunning this code on my desktop with a usb webcam produces the correct sized image. Running this on the pi takes about 17 seconds before the assert fails.
Additionally, is the guidance that libcamerify has to be used for any raspberry pi camera module regardless of the camera module version? Or is the issue that pi 3a+ is too old? One of the reasons I bought this new camera was that I had read that the old camera stack was deprecated on Bookworm, so I was hoping that with a newer camera module I could take libcamerify out of the application stack to simplify things.
I'm noticing some odd behavior with my camera module v 3 and libcamerify in that the dimensions of my frame captures in OpenCV 4.11 are very incorrect. For example, if I request a 320x240 pixel image and I try to convert the frame capture to jpeg it will fail because the dimensions are larger than what the jpeg file format can support. If I output to a tiff instead I get a 460800x1 pixel image.
Attempt with jpeg
Code:
[0:32:34.434584913] [1342] ERROR IPAModule ipa_module.cpp:171 Symbol ipaModuleInfo not found[0:32:34.434761995] [1342] ERROR IPAModule ipa_module.cpp:291 v4l2-compat.so: IPA module has no valid info[0:32:34.434825484] [1342] INFO Camera camera_manager.cpp:327 libcamera v0.4.0+53-29156679[0:32:34.487343998] [1367] WARN RPiSdn sdn.cpp:40 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise[0:32:34.491427826] [1367] INFO RPI vc4.cpp:447 Registered camera /base/soc/i2c0mux/i2c@1/imx708@1a to Unicam device /dev/media0 and ISP device /dev/media1[0:32:34.492724068] [1342] INFO Camera camera.cpp:1202 configuring streams: (0) 640x480-RGB888[0:32:34.493376772] [1367] INFO RPI vc4.cpp:622 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 1536x864-SBGGR10_1X10 - Selected unicam format: 1536x864-pBAA[0:32:34.496837062] [1342] INFO Camera camera.cpp:1202 configuring streams: (0) 640x480-RGB888[0:32:34.497462683] [1367] INFO RPI vc4.cpp:622 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 1536x864-SBGGR10_1X10 - Selected unicam format: 1536x864-pBAA[0:32:34.504207535] [1342] INFO Camera camera.cpp:1202 configuring streams: (0) 320x240-RGB888[0:32:34.504913676] [1367] INFO RPI vc4.cpp:622 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 1536x864-SBGGR10_1X10 - Selected unicam format: 1536x864-pBAA[0:32:34.506673613] [1342] INFO Camera camera.cpp:1202 configuring streams: (0) 320x240-RGB888[0:32:34.507231526] [1367] INFO RPI vc4.cpp:622 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 1536x864-SBGGR10_1X10 - Selected unicam format: 1536x864-pBAA[ERROR:0@0.523] global loadsave.cpp:1380 imencode imencode(): can't encode data: OpenCV(4.11.0) /io/opencv/modules/imgcodecs/src/grfmt_base.cpp:173: error: (-10:Unknown error code -10) Raw image encoder error: Maximum supported image dimension is 65500 pixels in function 'throwOnEror'If I take out libcamerify, I can't read a frame
Code:
capture = cv2.VideoCapture(0, cv2.CAP_V4L2)capture.set(cv2.CAP_PROP_FRAME_WIDTH, 320)capture.set(cv2.CAP_PROP_FRAME_HEIGHT, 240)assert capture.isOpened()success, frame = capture.read()assert success # fails here if no libcamerifysuccess, data = cv2.imencode('.tiff', frame)# ...Code:
[ WARN:0@10.440] global ./modules/videoio/src/cap_v4l.cpp (1013) tryIoctl VIDEOIO(V4L2:/dev/video0): select() timeout.Additionally, is the guidance that libcamerify has to be used for any raspberry pi camera module regardless of the camera module version? Or is the issue that pi 3a+ is too old? One of the reasons I bought this new camera was that I had read that the old camera stack was deprecated on Bookworm, so I was hoping that with a newer camera module I could take libcamerify out of the application stack to simplify things.
Code:
$ rpicam-still --list-camerasAvailable cameras-----------------0 : imx708 [4608x2592 10-bit RGGB] (/base/soc/i2c0mux/i2c@1/imx708@1a) Modes: 'SRGGB10_CSI2P' : 1536x864 [120.13 fps - (768, 432)/3072x1728 crop] 2304x1296 [56.03 fps - (0, 0)/4608x2592 crop] 4608x2592 [14.35 fps - (0, 0)/4608x2592 crop]Code:
$ uname -aLinux raspberrypi-3aplus 6.12.18-v8+ #1862 SMP PREEMPT Wed Mar 12 12:31:19 GMT 2025 aarch64 GNU/LinuxDebian GNU/Linux 12 (bookworm)Statistics: Posted by neuronswan — Sun Mar 16, 2025 6:49 am