Navigation

    VEYE IMAGING Forum

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

    SOLVED RAW-MIPI-AR0234M配置为4lane模式

    Machine Vision camera
    2
    55
    7791
    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 last edited by

      怎样在Jetson平台配置RAW-MIPI-AR0234M为4lane模式,并修改驱动和dts?

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

        1. 使用这个脚本,将camera的lane number配置为4,并保存参数。
        2. 修改dts源码,将2lane改为4lane。
          比如,对于jetson orin nano 8gb,可以修改dts源文件中的num_lanes为4。
        3. 编译dts源码,并部署实施。
        1 Reply Last reply Reply Quote 0
        • L
          lizi last edited by lizi

          您好,我想问一下这个60帧和120帧是基于raw格式下的吗?我用opencv去获取。就是我用opencv去获取frame,只能拿到640* 480分辨率下的60帧,如果设置为1920*1200就只有大概20帧。ar0234

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

            @lizi
            34f8c1cd-f518-40eb-9c30-d1ea6f9dd309-image.png
            试一下这个命令,显示的帧率是多少?

            export WIDTH=1920
            export HEIGHT=1200
            export FPS=60
            v4l2-ctl --set-fmt-video=width=$WIDTH,height=$HEIGHT,pixelformat=GREY --stream-mmap --stream-count=-1 --stream-to=/dev/null
            
            L 1 Reply Last reply Reply Quote 0
            • L
              lizi @veye_xumm last edited by

              @veye_xumm said in RAW-MIPI-AR0234M配置为4lane模式:

              export WIDTH=1920
              export HEIGHT=1200
              export FPS=60
              v4l2-ctl --set-fmt-video=width=$WIDTH,height=$HEIGHT,pixelformat=GREY --stream-mmap --stream-count=-1 --stream-to=/dev/null

              60帧

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

                @lizi 说明相机配置没问题,还是程序效率的问题。

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

                  @veye_xumm
                  截屏2024-01-19 17.45.12.png
                  这是我的捕获代码,那就是opencv效率的问题吗

                  veye_xumm L 2 Replies Last reply Reply Quote 0
                  • veye_xumm
                    veye_xumm @lizi last edited by

                    @lizi opencv底层我不太懂。但是最底下肯定是跟我刚才发的v4l2命令类似的接口获取的v4l2 buffer,有没有做什么数据搬移,数据格式转换,这个我确定不了。
                    你有没有试过我们这个demo?

                    1 Reply Last reply Reply Quote 0
                    • L
                      lizi @lizi last edited by

                      刚刚在我的代码之前加了v4l2的cmd最后还是只有大概20张

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

                        @lizi 什么意思?

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

                          @veye_xumm 就是把demo里最后循环里的cv2.imshow改成了计数。因为显示图片没法判断帧数。所以我改成了1s的计数。最后只有20截屏2024-01-19 17.58.13.png 截屏2024-01-19 17.58.33.png
                          把上面demo里的代码改成了下面的计数

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

                            @lizi 如此说来确实有这个问题。我们主要提供好驱动,opencv不是很熟。
                            你用jetson平台,最好还是用带jetson的硬件加速的开发包去开发。比如CUDA之类。
                            我们应用层和算法都不太熟悉。你可以到英伟达的开发者网站上找找资料。

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

                              @veye_xumm 那有没有办法用v4l2-ctl --set-fmt-video=width=$WIDTH,height=$HEIGHT,pixelformat=GREY --stream-mmap --stream-count=-1 --stream-to=/dev/null这个捕获帧的方法去捕获图片啊,这个获取的图片是raw格式的吗?

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

                                @lizi
                                我测了一下orin nano上面,实际采集数据的帧率是没有问题的。 你可以延长你的代码的统计时间到10秒,100秒,可以发现帧率会趋近于接近60fps。

                                那么为何出现你只统计1秒的时候,帧率只有20帧的结果呢? 我进行了一下简单的时间分析,发现是第一次调用cap.read()函数的时候,耗时大约半秒左右。(估计是底层进行buffer的初始化之类的操作。)

                                可以参考我贴上来这个代码:

                                import cv2
                                import argparse
                                import subprocess
                                import time
                                
                                def main():
                                    # Set up command-line argument parser
                                    parser = argparse.ArgumentParser(description='Real-time display of GREY image from /dev/video0')
                                    parser.add_argument('--roix', type=int, default=0, help='roi start x (default: 0)')
                                    parser.add_argument('--roiy', type=int, default=0, help='roi start y (default: 0)')
                                    parser.add_argument('--width', type=int, default=1920, help='image width (default: 640)')
                                    parser.add_argument('--height', type=int, default=1200, help='image height (default: 480)')
                                    parser.add_argument('--fps', type=int, default=60, help='frame rate (default: 30)')
                                    args = parser.parse_args()
                                    
                                    v4l2_cmd = f"v4l2-ctl --set-ctrl roi_x={args.roix}"
                                    subprocess.run(v4l2_cmd, shell=True)
                                    
                                    v4l2_cmd = f"v4l2-ctl --set-ctrl roi_y={args.roiy}"
                                    subprocess.run(v4l2_cmd, shell=True)
                                    
                                    v4l2_cmd = f"v4l2-ctl --set-fmt-video=width={args.width},height={args.height}"
                                    subprocess.run(v4l2_cmd, shell=True)
                                    
                                    v4l2_cmd = f"v4l2-ctl --set-ctrl frame_rate={args.fps}"
                                    subprocess.run(v4l2_cmd, shell=True)
                                    
                                    # Open the /dev/video0 device
                                    cap = cv2.VideoCapture('/dev/video0')
                                    if not cap.isOpened():
                                        print("Failed to open video device")
                                        return
                                
                                    # Set the image size
                                    cap.set(cv2.CAP_PROP_FRAME_WIDTH, args.width)
                                    cap.set(cv2.CAP_PROP_FRAME_HEIGHT, args.height)
                                
                                    frame_num = 0
                                    
                                    # Loop over frames and display them
                                    while True:
                                        # Read a frame
                                        ret, frame = cap.read()
                                        # Check if reading was successful
                                        if ret:
                                            if frame_num == 0:
                                                time_start = time.perf_counter()
                                            frame_num += 1
                                            # Display the frame
                                            # cv2.imshow('VEYE MV camera GREY image preview', frame)
                                            print(f"Success save , {frame_num}")
                                        else:
                                            print("Failed to read frame")
                                            #break
                                
                                        time_end = time.perf_counter()
                                        time_ms = (time_end - time_start)*1000
                                        print(time_ms)
                                        if time_ms > 1000:
                                            print(frame_num)
                                            break
                                
                                        # Exit if 'q' key is pressed
                                        if cv2.waitKey(1) & 0xFF == ord('q'):
                                            break
                                
                                    # Release resources
                                    cap.release()
                                    cv2.destroyAllWindows()
                                
                                if __name__ == '__main__':
                                    main()
                                
                                
                                L 1 Reply Last reply Reply Quote 0
                                • L
                                  lizi @veye_xumm last edited by

                                  @veye_xumm 好的

                                  L 1 Reply Last reply Reply Quote 0
                                  • L
                                    lizi @lizi last edited by lizi

                                    @veye_xumm 想问一下这里的曝光时间只有读取,没有写入的吗?设置曝光时间的命令是在哪里呢?在i2c.sh里截屏2024-01-23 12.10.07.png已经找到了

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

                                      @lizi
                                      请参考一下这个链接的part4.1

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

                                        This post is deleted!
                                        1 Reply Last reply Reply Quote 0
                                        • L
                                          lizi last edited by lizi

                                          @veye_xumm 截屏2024-01-23 16.22.05.png
                                          安装驱动出现这个错是为什么。板子是orin-nano 8gb ,然后mipi是ar0234

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

                                            @lizi i2c不通,你查查硬件连接,比如fpc排线方向。

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