IMX178 roi problem - rpi5
-
Hello,
I can't set proper roi on rpi5 and imx178 . Command history:./media_setting_rpi5.sh mvcam -fmt RAW8 -w 3088 -h 2064 This is a Raspberry Pi 5. camera name mvcam; width 3088; height 2064; media_fmt Y8_1X8; pixel_fmt GREY CAM1 probed: media device is /dev/media2 set CAM1 finish, plese get frame from /dev/video0 and use /dev/v4l-subdev2 for camera setting # v4l2-ctl --set-fmt-video=width=2600,height=2064 -d /dev/video0 # v4l2-ctl -d /dev/video0 --set-fmt-video=width=2600,height=2064,pixelformat=GREY --stream-mmap --stream-count=1 --stream-to=y8-2600x2064.raw VIDIOC_STREAMON returned -1 (Invalid argument) # v4l2-ctl -d /dev/video0 --set-fmt-video=width=3088,height=2064,pixelformat=GREY --stream-mmap --stream-count=1 --stream-to=y8-2600x2064.raw <(data captured)
Second example:
# ./media_setting_rpi5.sh mvcam -fmt RAW8 -w 2600 -h 2064 -c 1 # v4l2-ctl --set-ctrl roi_x=100 -d /dev/v4l-subdev2 # gst-launch-1.0 v4l2src device=/dev/video0 num-buffers=1 ! "video/x-raw,format=GRAY8,width=2600,height=2064, framerate=25/1" ! jpegenc ! filesink location=/tmp/test_roi100.jpgno matter what "number" I set in "v4l2-ctl --set-ctrl roi_x='number'"
there is no effect on image - always roi begins at 0,0.
Script ./mv_mipi_i2c.sh -r -f roi -b 4
always return: r roi is 0,0,2600,2064Second problem is "overflow" at 256 pixels in setting roi by mv_mipi_i2c.sh. Image captured after setting roi:
./mv_mipi_i2c.sh -w -f roi -p1 256 -p2 0 -p3 2600 -p4 2064 -b 4Is the same when:
./mv_mipi_i2c.sh -w -f roi -p1 0 -p2 0 -p3 2600 -p4 2064 -b 4;setting x-offset at maximus 248 pix works ok:
./mv_mipi_i2c.sh -w -f roi -p1 248 -p2 0 -p3 2600 -p4 2064 -b 4; -
@sanlu First example:
media_setting_rpi5.sh has internally called media-ctl and v4l2-ctl to configure the resolution. So there is no need to run v4l2-ctl after calling media_setting_rpi5.sh.
Try this:./media_setting_rpi5.sh mvcam -fmt RAW8 -w 3088 -h 2064 -c 1 v4l2-ctl -d /dev/video0 --stream-mmap --stream-count=1 --stream-to=y8-3104x2064.rawSecond example:
The configuration of roi requires all 4 relevant parameters to be configured together, not just one. This will not take effect.
-
@veye_xumm Your example at full resolution works fine. I don't want full resolution but width 2400px centered - it require ROI offseted by 344px, but after setting roi via mv_mipi_i2c.sh script (./mv_mipi_i2c.sh -w -f roi -p1 344 -p2 0 -p3 2400 -p4 2064 -b 4) image is offseted only 88px - offset is "modulo" 256px (i've send you images via e-mail).
Second example: How to set all 4 param in one command while "v4l2-ctl --set-ctrl roi_x " works on device /dev/v4l-subdev2 during "v4l2-ctl --set-fmt-video" works on /dev/video0 ?
-
Sorry, I didn't explain clearly earlier.
Based on your requirements, I recommend not using
mv_mipi_i2c.shfor configuration because it directly changes the settings inside the camera, but the v4l2 driver won't be aware of your parameter modifications.The following three commands form a complete ROI configuration:
v4l2-ctl --set-ctrl roi_x=344 v4l2-ctl --set-ctrl roi_y=0 v4l2-ctl --set-fmt-video=width=2400,height=2064As for the module issue you mentioned, after performing the above configuration, use the following commands to verify the actual parameters inside the camera:
mv_mipi_i2c.sh -r -f roi -b yourbus mv_mipi_i2c.sh -r -f version -b yourbusPlease send me the results once you've checked.
-
@veye_xumm Results:
# ./media_setting_rpi5.sh mvcam -fmt RAW8 -w 2400 -h 2064 -c 1 This is a Raspberry Pi 5. camera name mvcam; width 2400; height 2064; media_fmt Y8_1X8; pixel_fmt GREY CAM1 probed: media device is /dev/media1 set CAM1 finish, plese get frame from /dev/video0 and use /dev/v4l-subdev2 for camera setting # v4l2-ctl --set-ctrl roi_x=344 -d /dev/v4l-subdev2 # v4l2-ctl --set-ctrl roi_y=0 -d /dev/v4l-subdev2 # v4l2-ctl --set-fmt-video=width=2400,height=2064 -d /dev/video0 # ./mv_mipi_i2c.sh -r -f roi -b 4 r roi is 0,0,2400,2064 # ./mv_mipi_i2c.sh -r -f version -b 4 version is C 01.36 and L 02.01 -
@sanlu
Please download a new https://github.com/veyeimaging/raspberrypi_v4l2/tree/main/rpi5_scripts
Try./media_setting_rpi5.sh mvcam -fmt RAW10 -x 344 -y 0 -w 2400 -h 2064 -c 1then
mv_mipi_i2c.sh -r -f roi -b yourbus -
@veye_xumm Results below:
root@allsky2:~/raspberrypi_v4l2/rpi5_scripts# ./media_setting_rpi5.sh mvcam -fmt RAW10 -x 344 -y 0 -w 2400 -h 2064 -c 1 This is a Raspberry Pi 5. Kernel version is 6.6.51, do not support unpacked format. camera name mvcam; roi_x 344; roi_y 0;width 2400; height 2064; media_fmt Y10_1X10; pixel_fmt Y10P CAM1 probed: media device is /dev/media1 set CAM1 finish, plese get frame from /dev/video0 and use /dev/v4l-subdev2 for camera setting root@allsky2:~/raspberrypi_v4l2/rpi5_scripts# cd ../mv_tools_rpi/ /root/raspberrypi_v4l2/mv_tools_rpi root@allsky2:~/raspberrypi_v4l2/mv_tools_rpi# ./mv_mipi_i2c.sh -r -f roi -b 4 r roi is 0,0,2400,2064 -
@sanlu said in IMX178 roi problem - rpi5:
./media_setting_rpi5.sh mvcam -fmt RAW10 -x 344 -y 0 -w 2400 -h 2064 -c 1
Sorry , please pull a new update from github.
-
@veye_xumm Ok - now "mv_mipi_i2c.sh -r -f roi" show right values, but main problem exists: image not begin at 344px but 88.
But problem exists only at "x" - I've tested image 1200x1200 offseted by 512 and "y" begins at right position -
-
@veye_xumm
Perfect. Now is working as expected. Thanks!
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login