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