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

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

    Scheduled Pinned Locked Moved Machine Vision camera
    55 Posts 2 Posters 32.5k 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.
    • L Offline
      lizi
      last edited by lizi

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

      veye_xummV 1 Reply Last reply Reply Quote 0
      • veye_xummV Offline
        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
        

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

        L 1 Reply Last reply Reply Quote 0
        • L Offline
          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_xummV 1 Reply Last reply Reply Quote 0
          • veye_xummV Offline
            veye_xumm @lizi
            last edited by

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

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

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

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

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

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

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

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

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

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

                    @lizi 什么意思?

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

                    L 1 Reply Last reply Reply Quote 0
                    • L Offline
                      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_xummV 1 Reply Last reply Reply Quote 0
                      • veye_xummV Offline
                        veye_xumm @lizi
                        last edited by

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

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

                        L 1 Reply Last reply Reply Quote 0
                        • L Offline
                          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_xummV 1 Reply Last reply Reply Quote 0
                          • veye_xummV Offline
                            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()
                            
                            

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

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

                              @veye_xumm 好的

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

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

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

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

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

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

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

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

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

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

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

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

                                          @veye_xumm
                                          截屏2024-01-23 17.24.22.png
                                          这是两边的插线方向。这个是对的吗orin-nano的有数据的线朝外侧,mipi有数据的线朝下方
                                          截屏2024-01-23 17.04.52.png
                                          我参考这个来安装的

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

                                            @veye_xumm 还是有这个问题,这个是说明驱动式成功安装了是吗?只是硬件上的传输有问题吗

                                            veye_xummV 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