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

Camera board • rpicam-still fails with “invalid argument” error when used in cropped camera mode (via media-ctl) with Pi GS camera

$
0
0
The latest libcamera and rpicam-apps (built from current source this week) do not appear to work with cropping modes for the Global Shutter (GS) camera. Nor does any rpicam-app-derived code.

I’m on a RPi4 with 64-bit Bullseye, all up-to-date. Please see environmental details at the end of this email.

To replicate the problem, all that appears to be needed is to:
1) run media-ctl to set a small cropping mode and then
2) try to run rpicam-still.

Here’s a demonstration. First, this initial test shows that rpi-still works fine in a full 1456/1088 (non-cropped) mode:

➜ media-ctl -d "/dev/media3" --set-v4l2 "'imx296 10-001a':0 [fmt:SBGGR10_1X10/100x100 crop:(0,0)/1456x1088]" -v
Opening media device /dev/media3
Enumerating entities
looking up device: 81:15
looking up device: 81:14
Found 2 entities
Enumerating pads and links
Setting up selection target 0 rectangle (0,0)/1456x1088 on pad imx296 10-001a/0
Selection rectangle set: (0,0)/1456x1088
Setting up format SBGGR10_1X10 100x100 on pad imx296 10-001a/0
Format set: SBGGR10_1X10 1456x1088

➜ rpicam-still --gain 3.0 --nopreview --tuning-file=/usr/share/libcamera/ipa/rpi/vc4/imx296.json --shutter 100000 --width 1456 --height 1088 --denoise cdn_off -o test.png
[5:41:45.171313180] [9537] INFO Camera camera_manager.cpp:284 libcamera v0.2.0+120-eb00c13d
[5:41:45.202506453] [9538] WARN RPiSdn sdn.cpp:40 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[5:41:45.205026528] [9538] INFO RPI vc4.cpp:446 Registered camera /base/soc/i2c0mux/i2c@1/imx296@1a to Unicam device /dev/media3 and ISP device /dev/media0
[5:41:45.205101341] [9538] INFO RPI pipeline_base.cpp:1102 Using configuration file '/usr/local/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
Mode selection for 728:544:12:P
SRGGB10_CSI2P,1456x1088/0 - Score: 1318
Stream configuration adjusted
[5:41:45.206251103] [9537] INFO Camera camera.cpp:1183 configuring streams: (0) 728x544-YUV420 (1) 1456x1088-SBGGR10_CSI2P
[5:41:45.207789025] [9538] INFO RPI vc4.cpp:621 Sensor: /base/soc/i2c0mux/i2c@1/imx296@1a - Selected sensor format: 1456x1088-SBGGR10_1X10 - Selected unicam format: 1456x1088-pBAA
Mode selection for 1456:1088:12:P
SRGGB10_CSI2P,1456x1088/0 - Score: 1000
[5:41:50.826417916] [9537] INFO Camera camera.cpp:1183 configuring streams: (0) 1456x1088-YUV420 (1) 1456x1088-SBGGR10_CSI2P
[5:41:50.828358721] [9538] INFO RPI vc4.cpp:621 Sensor: /base/soc/i2c0mux/i2c@1/imx296@1a - Selected sensor format: 1456x1088-SBGGR10_1X10 - Selected unicam format: 1456x1088-pBAA
Still capture image received
(The above produces an appropriate .png file)
==============

However, if the camera is set to a cropping mode, rpi-still fails as follows:

➜ media-ctl -d "/dev/media3" --set-v4l2 "'imx296 10-001a':0 [fmt:SBGGR10_1X10/96x88 crop:(0,0)/96x88]" -v
Opening media device /dev/media3
Enumerating entities
looking up device: 81:15
looking up device: 81:14
Found 2 entities
Enumerating pads and links
Setting up selection target 0 rectangle (0,0)/96x88 on pad imx296 10-001a/0
Selection rectangle set: (0,0)/96x88
Setting up format SBGGR10_1X10 96x88 on pad imx296 10-001a/0
Format set: SBGGR10_1X10 96x88

➜ rpicam-hello --list-cameras (just to confirm the mode)
Available cameras
-----------------
0 : imx296 [1456x1088 10-bit RGGB] (/base/soc/i2c0mux/i2c@1/imx296@1a)
Modes: 'SRGGB10_CSI2P' : 1456x1088 [572.08 fps - (0, 0)/96x88 crop]

Here’s the failure:
➜ rpicam-still --gain 3.0 --nopreview --tuning-file=/usr/share/libcamera/ipa/rpi/vc4/imx296.json --shutter 100000 --width 96 --height 88 --denoise cdn_off -o /mnt/VerdantShare/dev/GolfSim/LM/Images/t.png (also fails with other width/height settings)


[5:50:45.666626985] [9666] INFO Camera camera_manager.cpp:284 libcamera v0.2.0+120-eb00c13d
[5:50:45.697709358] [9667] WARN RPiSdn sdn.cpp:40 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[5:50:45.700329633] [9667] INFO RPI vc4.cpp:446 Registered camera /base/soc/i2c0mux/i2c@1/imx296@1a to Unicam device /dev/media3 and ISP device /dev/media0
[5:50:45.700449557] [9667] INFO RPI pipeline_base.cpp:1102 Using configuration file '/usr/local/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
Mode selection for 592:544:12:P
SRGGB10_CSI2P,1456x1088/0 - Score: 1445.75
Stream configuration adjusted
[5:50:45.701558503] [9666] INFO Camera camera.cpp:1183 configuring streams: (0) 592x544-YUV420 (1) 1456x1088-SBGGR10_CSI2P
[5:50:45.701998607] [9667] INFO RPI vc4.cpp:621 Sensor: /base/soc/i2c0mux/i2c@1/imx296@1a - Selected sensor format: 96x88-SBGGR10_1X10 - Selected unicam format: 1456x1088-pBAA
[5:50:45.717829937] [9667] ERROR V4L2 v4l2_videodevice.cpp:1906 /dev/video0[13:cap]: Failed to start streaming: Invalid argument
ERROR: *** failed to start camera ***

Any ideas what’s wrong or how to get around this?
Thank you!

Environmental details:
➜ uname -a
Linux rsp03 6.1.47-v8+ #1 SMP PREEMPT Fri Aug 25 15:56:39 UTC 2023 aarch64 GNU/Linux

Statistics: Posted by jpilgrim — Mon Apr 29, 2024 7:39 pm — Replies 2 — Views 105



Viewing all articles
Browse latest Browse all 4670

Trending Articles