Navigation

    VEYE IMAGING Forum

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

    SOLVED 移植MV-IMX265驱动程序到迅为RK3568抓图卡死

    VEYE MIPI camera
    2
    39
    5054
    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 @w88121446 last edited by

      @w88121446
      是参考我们在rk平台的这个python程序吗? 能否截图看一下具体错误?
      /dev/video0是否存在?

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

        @veye_xumm /dev/video0确认存在的,用的下面这个PY脚本

        import sys
        import argparse
        import subprocess
        import cv2
        
        def read_cam(width, height, fps,i2c):
            
            v4l2_cmd = f'media-ctl -d /dev/media0 --set-v4l2 \'"m00_b_mvcam 2-003b":0[fmt:Y8_1X8/{width}x{height}@1/{fps} field:none]\''
            subprocess.run(v4l2_cmd, shell=True)
            
            cap = cv2.VideoCapture(f"v4l2src io-mode=dmabuf device=/dev/video0 ! video/x-raw, format=(string)GRAY8, width=(int){width}, height=(int){height} ! appsink")
            if cap.isOpened():
                cv2.namedWindow("demo", cv2.WINDOW_AUTOSIZE)
                while True:
                    ret_val, img = cap.read();
                    cv2.imshow('demo',img)
                    cv2.waitKey(1)
            else:
             print ("camera open failed");
        
            cv2.destroyAllWindows()
        if __name__ == '__main__':
            parser = argparse.ArgumentParser(description='Read camera video stream')
            parser.add_argument('--width', type=int, default=1080, help='width of the video stream')
            parser.add_argument('--height', type=int, default=1080, help='height of the video stream')
            parser.add_argument('--fps', type=int, default=30, help='fps of the video stream')
            parser.add_argument('--i2c', type=int, default=7, help='i2c bus number')
            args = parser.parse_args()
        
            read_cam(args.width, args.height, args.fps, args.i2c)
        

        报错如下
        23ca28c19180d09616cfb3508239726.jpg

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

          @w88121446 调用的时候参数是怎么写的? i2cbus写对了吗?

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

            @veye_xumm
            我是这么写的,我的I2C用的I2C2,产品分辨率2048*1544

            import sys
            import argparse
            import subprocess
            import cv2
            
            def read_cam(width, height, fps,i2c):
                
                v4l2_cmd = f'media-ctl -d /dev/media0 --set-v4l2 \'"m00_b_mvcam {i2c}-003b":0[fmt:Y8_1X8/{width}x{height}@1/{fps} field:none]\''
                subprocess.run(v4l2_cmd, shell=True)
                
                cap = cv2.VideoCapture(f"v4l2src io-mode=dmabuf device=/dev/video0 ! video/x-raw, format=(string)GRAY8, width=(int){width}, height=(int){height} ! appsink")
                if cap.isOpened():
                    cv2.namedWindow("demo", cv2.WINDOW_AUTOSIZE)
                    while True:
                        ret_val, img = cap.read();
                        cv2.imshow('demo',img)
                        cv2.waitKey(1)
                else:
                 print ("camera open failed");
                cv2.destroyAllWindows()
            if __name__ == '__main__':
                parser = argparse.ArgumentParser(description='Read camera video stream')
                parser.add_argument('--width', type=int, default=2048, help='width of the video stream')
                parser.add_argument('--height', type=int, default=1544, help='height of the video stream')
                parser.add_argument('--fps', type=int, default=30, help='fps of the video stream')
                parser.add_argument('--i2c', type=int, default=2, help='i2c bus number')
                args = parser.parse_args()
                read_cam(args.width, args.height, args.fps, args.i2c)
            
            veye_xumm 1 Reply Last reply Reply Quote 0
            • veye_xumm
              veye_xumm @w88121446 last edited by

              @w88121446 不好意思我没有说清楚,我的意思是,你调用这个脚本的时候,使用的命令行是什么?参数是什么?

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

                @veye_xumm这样调用的

                python3 v4l2dev_2_opencv_show_grey.py

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

                  @w88121446
                  需要给一下必要的参数

                  python3 ./v4l2dev_2_opencv_show_grey.py --width 2048 --height 1544 --fps 45 --i2c 2
                  
                  W 1 Reply Last reply Reply Quote 0
                  • W
                    w88121446 @veye_xumm last edited by w88121446

                    @veye_xumm 我使用您发给我的命令还是不能打开caramer,再次确认了是I2C-2没有错
                    8edbc1da-117c-40ac-b30b-685045e7dc65-image.png

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

                      @w88121446 said in 移植MV-IMX265驱动程序到迅为RK3568抓图卡死:

                      图像可以采集出来了,想实时预览的话有什么办法吗?

                      此时你说的图像可以采集出来,是怎么判断的?

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

                        @veye_xumm 可以使用下面这个命令拍照,图片正常

                        ./yavta -c1 -Fy81-2048x1544.raw --skip 0 -f Y8 -s 2048x1544 /dev/video0
                        
                        veye_xumm 1 Reply Last reply Reply Quote 0
                        • veye_xumm
                          veye_xumm @w88121446 last edited by

                          @w88121446
                          如果是这样,驱动层是没有问题的。
                          怀疑是使用 OpenCV 的 GStreamer 管道时,确保正确安装和配置了 GStreamer:
                          在某些系统上,GStreamer 可能没有正确配置,导致 OpenCV 无法通过 GStreamer 打开视频设备。

                          gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,format=GRAY8,width=2048,height=1544 ! autovideosink
                          
                          W 1 Reply Last reply Reply Quote 0
                          • W
                            w88121446 @veye_xumm last edited by w88121446

                            @veye_xumm said in 移植MV-IMX265驱动程序到迅为RK3568抓图卡死:

                            gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,format=GRAY8,width=2048,height=1544 ! autovideosink

                            用您发的这个命令的话,我要把format=GRAY8改成format=NV12才能预览。

                            关于GStreamer 可能没有正确配置,导致 OpenCV 无法通过 GStreamer 打开视频设备。这个事情,我就查一查GStreamer的配置问题是吧!

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

                              @w88121446 我们用的firefly的板子,gstreamer是支持gray8数据格式的。

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