OpenCV Python: cv2.VideoCapture can only find 2 of 3 cameras, Windows Camera app finds all

前端 未结 4 804
自闭症患者
自闭症患者 2021-02-19 00:38

I\'m trying to create 3 real-time capture frames with webcams into a USB hub into my laptop. Using the \"camera\" app on Windows, I can change the camera source one at a time an

相关标签:
4条回答
  • 2021-02-19 00:46

    1) about cv2... Well, is there any other instances/alternatives? maybe that third cam is binded to other instance instead of cv2 ?

    2) did you try to start loop (range) from -1 instead of 0?

    3) If none of the method helps you, I advise to go to Device Manager and temporarily DISABLE the individual webcam and then run your script again and see what changes. After that ENABLE webcam and see what changed. ( in worst scenario, instead of ENABLE/DISABLE, you might insall/resintall the particular webcam and then windows might resolve them correctly).

    0 讨论(0)
  • 2021-02-19 00:46

    First,we have to test your webcam can or cannot be connect to OPENCV.

    connect only one webcam,and run your program with cv2.VideoCapture(0).Parameter 0 mean there is a single camera connected. if all your webcam is ok,then it will be problem of index,there is some code which will find the deviceID assigned to the cam.

    and if some webcam unfortunately fail,then it will be hard.

    In this case you have to create your own function that grabs using the SDK and write the image into a cv::Mat.

    0 讨论(0)
  • 2021-02-19 00:53

    Do your webcams support USB3? Based on my practical experience with webcams and OpenCV, most common cameras only transmit on the USB2 standard, at 480 MBit/s. The exact details of how many cameras you can support on one USB channel depend on the resolution, framerate, and video compression technology. In my experience, with 1080p color video at 30 fps and H.264 encoding, only one camera stream fit onto a single USB controller.

    An easy test to see if you are bandwidth limited would be to modify your program to explicitly close each stream after it is tested (cap.release()), so that your test program only opens one camera at a time, like the Windows camera app. If that works, then you may very well be looking at a bandwidth limitation.

    When debugging video capture issues on Windows, it can also be useful to open the camera streams with VLC. VLC can enumerate all of the cameras available from DirectShow, which is the same API that OpenCV's VideoCapture uses by default. You can also start multiple VLC instances to attempt simultaneous streams.

    If you click on "Advanced Options" and then check "Device Properties," VLC will show which settings (exposure, focus, etc...) can be tweaked through DirectShow. These settings are usually accessible in OpenCV through VideoCapture.set().

    0 讨论(0)
  • 2021-02-19 00:54

    having two video input devices does not automatically mean that their IDs are 0 and 10. Try to access the all cameras by increasing to about 500 or more instead of 10

    cams_test = 500
    for i in range(0, cams_test):
        cap = cv2.VideoCapture(i)
        test, frame = cap.read()
        if test:
            print("i : "+str(i)+" /// result: "+str(test))
    

    I think you are only testing

    0 讨论(0)
提交回复
热议问题