Currently trying to simultaneously capturing 10 images with 10 usb cameras connected to a Raspberry Pi 4 (through board USB ports and usb hub) with Ubuntu 18.04 installed. I am using a multithreading approach to create multiple camera objects which will capture photos. I have it currently working for 4 cameras (this goes up to /dev/video7, with each physical camera occupying 2 device indicies.
The issue I am currently having is accessing any camera device greater than 7 index (5 or higher physical camera won't be accessed). I currently get the following error:
"VIDEOIO ERROR: V4L: index 8 is not correct!"
which is associated to the opencv_3.4.1 source file located in modules/videoio/src/cap_v4l.cpp. In this source file it mentions it was tested for up to 8 inputs, has anyone managed to get more than 8 input devices to capture photos using a Raspberry Pi?
I will also add bit of debugging information I have already tried.
- Changed #define MAX_CAMERAS 8 (located in cap_v4l.cpp) to a larger value and rebuilt the opencv module however it had no affect.
- I have also tried just accessing any camera with a device index greater than 7 by themselves and it still persists.
- I managed to access these cameras using usb_cam on ROS melodic so they are working and connecting properly. I would prefer to get this working via opencv-python if possible but if no solution arises I will explore a ROS approach to solve the task.
Any help or advice is appreciated, thanks.
question from:
https://stackoverflow.com/questions/65948516/is-it-possible-to-use-cv2-videocapture-to-access-video-devices-greater-than-7-in 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…