Navigation

    VEYE IMAGING Forum

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Recent
    • Popular
    • Users
    • WIKI
    • veye.cc

    SOLVED IMX178 roi problem - rpi5

    Machine Vision camera
    2
    11
    1012
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • veye_xumm
      veye_xumm @sanlu last edited by

      @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.raw
      

      Second example:

      The configuration of roi requires all 4 relevant parameters to be configured together, not just one. This will not take effect.

      S 1 Reply Last reply Reply Quote 0
      • S
        sanlu @veye_xumm last edited by

        @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 ?

        veye_xumm 1 Reply Last reply Reply Quote 0
        • veye_xumm
          veye_xumm @sanlu last edited by

          @sanlu

          Sorry, I didn't explain clearly earlier.

          Based on your requirements, I recommend not using mv_mipi_i2c.sh for 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=2064
          

          As 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 yourbus
          

          Please send me the results once you've checked.

          S 1 Reply Last reply Reply Quote 0
          • S
            sanlu @veye_xumm last edited by

            @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
            
            veye_xumm 1 Reply Last reply Reply Quote 0
            • veye_xumm
              veye_xumm @sanlu last edited by

              @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 1
              

              then

              mv_mipi_i2c.sh -r -f roi -b yourbus
              
              S 1 Reply Last reply Reply Quote 0
              • S
                sanlu @veye_xumm last edited by

                @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 
                
                veye_xumm 1 Reply Last reply Reply Quote 0
                • veye_xumm
                  veye_xumm @sanlu last edited by

                  @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.

                  1 Reply Last reply Reply Quote 0
                  • S
                    sanlu last edited by

                    @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 1 Reply Last reply Reply Quote 0
                    • veye_xumm
                      veye_xumm @sanlu last edited by

                      @sanlu
                      This is indeed a bug, please refer to this link below to upgrade the camera firmware to version MV-MIPI-IMX178M_C1.44_L2.01_upgrade_20241121.bin.

                      S 1 Reply Last reply Reply Quote 0
                      • S
                        sanlu @veye_xumm last edited by

                        @veye_xumm
                        Perfect. Now is working as expected. Thanks!

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post