VEYE IMAGING Forum
    • Categories
    • Tags
    • Recent
    • Popular
    • Users
    • WIKI
    • veye.cc
    • Register
    • Login

    执行编译出来的./video12 800 800 60 得到的图像。像是按照4:3拉伸得到的图像, 并不是裁剪出来的800 *800的正方形

    Scheduled Pinned Locked Moved Machine Vision camera
    32 Posts 2 Posters 14.4k Views 1 Watching
    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_xummV Offline
      veye_xumm @nb
      last edited by

      @nb
      参考我们这个demo,我看到你的代码中

      std::string v4l2_cmd = "media-ctl -d /dev/video0 --set-v4l2 '\"m00_b_mvcam 7-003b\":0[fmt:Y8_1X8/" + std::to_string(width) + "x" + std::to_string(height) + "@1/" + std::to_string(fps) + " field:none]'";
      

      -d /dev/video0似乎应该改为-d /dev/media0

      Questions will be answered as soon as possible, please be patient.
      如果你使用中文,请直接用中文提问。
      May the force be with YOU. (This is the translation of the mysterious Chinese symbol above.)

      N 2 Replies Last reply Reply Quote 0
      • N Offline
        nb @veye_xumm
        last edited by

        在video12.cpp里改成了-d /dev/media0, 出图还是会有拉伸的效果,
        附近上传的是rk3588的dmesg 打印。还有video12.cpp的应用程序。还有就是出图效果png文件,帮忙再分析看看是什么原因

        video12.txt test.png log-3-12.txt

        1 Reply Last reply Reply Quote 0
        • N Offline
          nb @veye_xumm
          last edited by

          @veye_xumm

          用你们的python demo v4l2dev_2_opencv_show_grey.py出图也是一样的效果

          test2.png

          veye_xummV 1 Reply Last reply Reply Quote 0
          • veye_xummV Offline
            veye_xumm @nb
            last edited by

            @nb 我看你执行这两个程序都有报错的提示。
            猜测可能你的板子跟我们例程的板子有所不同。具体而言就是是不是/dev/video0和/dev/media0对应着这个相机?
            看现象就是ROI没有正确按照你想要的配置进去。你可以用i2c脚本直接读取参数的形式来确认这一点。

            ./mv_mipi_i2c.sh -r -f roi -b your_i2c_bus_number
            

            https://wiki.veye.cc/index.php/Mv_mipi_i2c.sh_user_guide#roi.2A

            Questions will be answered as soon as possible, please be patient.
            如果你使用中文,请直接用中文提问。
            May the force be with YOU. (This is the translation of the mysterious Chinese symbol above.)

            N 1 Reply Last reply Reply Quote 0
            • N Offline
              nb @veye_xumm
              last edited by

              @veye_xumm 系统启动后 ,直接用python3 v4l2dev_2_opencv_show_grey.py --width=1440 --height=1088 --fps=60 这个来出图,不做任何ROI裁剪 ,得到的图像,也是有拉伸效果。 所以我觉得 应该不是 后期通过i2c配置ROI导致的。
              1440-1088.png

              veye_xummV 1 Reply Last reply Reply Quote 0
              • veye_xummV Offline
                veye_xumm @nb
                last edited by

                @nb 相机本身并不具备单个方向缩放的能力,你可以尝试参考7.4.3或者7.4.4保存一个图片,然后查看一下。

                Questions will be answered as soon as possible, please be patient.
                如果你使用中文,请直接用中文提问。
                May the force be with YOU. (This is the translation of the mysterious Chinese symbol above.)

                N 1 Reply Last reply Reply Quote 0
                • N Offline
                  nb @veye_xumm
                  last edited by

                  @veye_xumm said in 执行编译出来的./video12 800 800 60 得到的图像。像是按照4:3拉伸得到的图像, 并不是裁剪出来的800 *800的正方形:

                  7.4.3

                  好的 我试下 非常感谢你的帮助

                  N 1 Reply Last reply Reply Quote 0
                  • N Offline
                    nb @nb
                    last edited by

                    @nb 用这个命令./yavta -c1 -Fy8-${1440}x${1088}.raw --skip 0 -f Y8 -s ${WIDTH}x${HEIGHT} /dev/video0 抓到的raw图像然后转成png后,看到的还是会有拉伸效果

                    veye_xummV 1 Reply Last reply Reply Quote 0
                    • veye_xummV Offline
                      veye_xumm @nb
                      last edited by

                      @nb
                      raw8数据可以直接用这个播放器看,不需要转。另外你可以把原始数据文件压缩一下传上来我看看。
                      https://yuv-player-deluxe.software.informer.com/2.6/

                      Questions will be answered as soon as possible, please be patient.
                      如果你使用中文,请直接用中文提问。
                      May the force be with YOU. (This is the translation of the mysterious Chinese symbol above.)

                      N 1 Reply Last reply Reply Quote 0
                      • N Offline
                        nb @veye_xumm
                        last edited by

                        @veye_xumm 【有道云笔记】抓图测试raw 文件
                        https://note.youdao.com/s/J6oOs0K3

                        你好 ,论坛 不支持上传raw文件,我直接把./yavta -c1 -Fy14-${WIDTH}x${HEIGHT}.raw --skip 0 -f Y8 -s ${WIDTH}x${HEIGHT} /dev/video0 用这个命令抓到的文件,上传到自己的有道云笔记上了,然后上面是分享出来的链接。

                        gensong@ros2-ubuntu20-by-nb:~/yavta-main$ ./yavta -c1 -Fy14-${WIDTH}x${HEIGHT}.raw --skip 0 -f Y8 -s ${WIDTH}x${HEIGHT} /dev/video0
                        Device /dev/video0 opened.
                        Device rkcif' on platform:rkcif-mipi-lvds2' (driver 'rkcif') supports video, capture, with mplanes.
                        Video format set: Y8 (59455247) 1440x1088 field none, 1 planes:

                        • Stride 1536, buffer size 1671168
                          Video format: Y8 (59455247) 1440x1088 field none, 1 planes:
                        • Stride 1536, buffer size 1671168
                          8 buffers requested.
                          length: 1 offset: 4269494424 timestamp type/source: mono/EoF
                          Buffer 0/0 mapped at address 0x7f93a9a000.
                          length: 1 offset: 4269494424 timestamp type/source: mono/EoF
                          Buffer 1/0 mapped at address 0x7f93902000.
                          length: 1 offset: 4269494424 timestamp type/source: mono/EoF
                          Buffer 2/0 mapped at address 0x7f9376a000.
                          length: 1 offset: 4269494424 timestamp type/source: mono/EoF
                          Buffer 3/0 mapped at address 0x7f935d2000.
                          length: 1 offset: 4269494424 timestamp type/source: mono/EoF
                          Buffer 4/0 mapped at address 0x7f9343a000.
                          length: 1 offset: 4269494424 timestamp type/source: mono/EoF
                          Buffer 5/0 mapped at address 0x7f932a2000.
                          length: 1 offset: 4269494424 timestamp type/source: mono/EoF
                          Buffer 6/0 mapped at address 0x7f9310a000.
                          length: 1 offset: 4269494424 timestamp type/source: mono/EoF
                          Buffer 7/0 mapped at address 0x7f92f72000.
                          any 0 1671168 B 10294.365447 10294.365674 30.115 fps ts mono/EoF

                          Captured 1 frames in 0.033432 seconds (29.910778 fps, 0.000000 B/s).
                          8 buffers released.
                          这个是抓图时的打印log输出
                        veye_xummV 1 Reply Last reply Reply Quote 0
                        • veye_xummV Offline
                          veye_xumm @nb
                          last edited by

                          @nb
                          你这个图片有一些莫名其妙的竖条纹,我觉得相机的输出和你的接收现在是不配套的。你执行

                          ./yavta -c1 -Fy14-${WIDTH}x${HEIGHT}.raw --skip 0 -f Y8 -s ${WIDTH}x${HEIGHT} /dev/video0
                          

                          之前设置WIDTH或者HEIGHT等全局变量了吗?

                          3e27f441-0731-4add-8d7a-c041a4e67edf-image.png

                          Questions will be answered as soon as possible, please be patient.
                          如果你使用中文,请直接用中文提问。
                          May the force be with YOU. (This is the translation of the mysterious Chinese symbol above.)

                          N 1 Reply Last reply Reply Quote 0
                          • N Offline
                            nb @veye_xumm
                            last edited by

                            @veye_xumm said in 执行编译出来的./video12 800 800 60 得到的图像。像是按照4:3拉伸得到的图像, 并不是裁剪出来的800 *800的正方形:

                            之前设置WIDTH或者HEIGHT等全局变量了吗?

                            1.png

                            配置了的 写了个脚本 ,会先执行 source ./set-wh.sh 然后再echo打印看下 ,配置的有没有成功

                            veye_xummV 1 Reply Last reply Reply Quote 0
                            • veye_xummV Offline
                              veye_xumm @nb
                              last edited by

                              @nb
                              你的主板应该不是我用的ROC-RK3588S-PC吧?
                              我怀疑是ROI配置没有配下去。
                              你现在用这个命令读出来roi配置试试:

                              ./mv_mipi_i2c.sh -r -f roi -b your_i2c_bus_number
                              

                              参考:
                              https://wiki.veye.cc/index.php/Mv_mipi_i2c.sh_user_guide#roi.2A

                              Questions will be answered as soon as possible, please be patient.
                              如果你使用中文,请直接用中文提问。
                              May the force be with YOU. (This is the translation of the mysterious Chinese symbol above.)

                              N 1 Reply Last reply Reply Quote 0
                              • N Offline
                                nb @veye_xumm
                                last edited by

                                @veye_xumm mv7.sh.png
                                这里得到的结果是0x05a0(1440) 0x0440(1088)

                                你之前提供的脚本是2字节读写的,应该不对, 我做了些调整,改正4字节读写了 2.png

                                N veye_xummV 2 Replies Last reply Reply Quote 0
                                • N Offline
                                  nb @nb
                                  last edited by

                                  @nb 我们是用 RK3588自己做的底板

                                  N 1 Reply Last reply Reply Quote 0
                                  • N Offline
                                    nb @nb
                                    last edited by

                                    @veye_xumm 我有一个怀疑的点。是驱动里日志打印来看这里获取到最大值mvcam: mvcam_probe: max width 1456; max height 1088
                                    后 然后接着就是读取ROI, mvcam: mvcam_getroi:get roi(0,0,1440,1088)

                                    但是我并没有从驱动代码里找到 有设置ROI为14401088的地方,麻烦能告诉一下驱动里设置ROI为14401088的代码在哪里吗, 我想把驱动代码里设置ROI为1440*1088的代码给注释掉试试。

                                    1 Reply Last reply Reply Quote 0
                                    • veye_xummV Offline
                                      veye_xumm @nb
                                      last edited by

                                      @nb said in 执行编译出来的./video12 800 800 60 得到的图像。像是按照4:3拉伸得到的图像, 并不是裁剪出来的800 *800的正方形:

                                      你之前提供的脚本是2字节读写的,应该不对, 我做了些调整,改正4字节读写了

                                      我们提供的脚本没问题,直接make一下之后调用就可以。

                                      你分别执行一下这两个命令,贴上来结果我看一下:

                                      v4l2-ctl -d /dev/v4l-subdev2 -L
                                      media-ctl -p -d /dev/media0
                                      

                                      Questions will be answered as soon as possible, please be patient.
                                      如果你使用中文,请直接用中文提问。
                                      May the force be with YOU. (This is the translation of the mysterious Chinese symbol above.)

                                      N 2 Replies Last reply Reply Quote 0
                                      • N Offline
                                        nb @veye_xumm
                                        last edited by

                                        @veye_xumm said in 执行编译出来的./video12 800 800 60 得到的图像。像是按照4:3拉伸得到的图像, 并不是裁剪出来的800 *800的正方形:

                                        分别执行一下这两个命令,贴上来

                                        gensong@ros2-ubuntu20-by-nb:~/20$ v4l2-ctl -d /dev/v4l-subdev2 -L

                                        User Controls

                                                       trigger_mode 0x00981901 (int)    : min=0 max=2 step=1 default=0 value=0 flags=grabbed, volatile, execute-on-write
                                                        trigger_src 0x00981902 (int)    : min=0 max=1 step=1 default=1 value=1 flags=grabbed, volatile, execute-on-write
                                                        soft_trgone 0x00981903 (button) : flags=write-only, execute-on-write
                                                         frame_rate 0x00981904 (int)    : min=0 max=60 step=1 default=60 value=60 flags=grabbed, volatile, execute-on-write
                                                              roi_x 0x00981905 (int)    : min=0 max=1376 step=8 default=0 value=0 flags=grabbed
                                                              roi_y 0x00981906 (int)    : min=0 max=1024 step=4 default=0 value=0 flags=grabbed
                                        

                                        Image Processing Controls

                                                     link_frequency 0x009f0901 (intmenu): min=0 max=0 default=0 value=0
                                                                    0: 750000000 (0x2cb41780)
                                                         pixel_rate 0x009f0902 (int64)  : min=750000000 max=750000000 step=1 default=750000000 value=750000000 flags=read-only
                                        

                                        gensong@ros2-ubuntu20-by-nb:~/20$

                                        1 Reply Last reply Reply Quote 0
                                        • N Offline
                                          nb @veye_xumm
                                          last edited by

                                          @veye_xumm media-ctl.txt

                                          veye_xummV 1 Reply Last reply Reply Quote 0
                                          • veye_xummV Offline
                                            veye_xumm @nb
                                            last edited by

                                            @nb 看起来你的配置没有问题。
                                            有没有可能是硬件的问题?你试过ROC-RK3588S-PC主板上的结果吗?

                                            Questions will be answered as soon as possible, please be patient.
                                            如果你使用中文,请直接用中文提问。
                                            May the force be with YOU. (This is the translation of the mysterious Chinese symbol above.)

                                            N 1 Reply Last reply Reply Quote 0

                                            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
                                            • First post
                                              Last post