Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Multi-Cam Support on Raspberry Pi

I am running Python 3.4, Open CV 3.2, Raspbian Jessie, and two ELP Mini USB Cameras. When I open the two cameras:

cap0 = cv2.VideoCapture(0)
cap1 = cv2.VideoCapture(1)

I get the following error in the console every time, which can cause a variety of issues with displaying/saving the camera images:

VIDIOC_QUERYCTRL: Input/output error
VIDIOC_QUERYCTRL: Input/output error

Running dmesg gives:

uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -110 
uvcvideo: Failed to query (GET_DEF) UVC control 3 on unit 2: -110

I am a newbie to OpenCV and raspberry pi/linux, but from what I've been able to gather there's an issue with Video4Linux where it produces the error because it can't distinguish between the two identical cameras plugged in. If I swap one of the cameras out such that there is two different camera models plugged into the Pi the error is no longer produced and everything works reliably. However, I would like to use the two identical cameras.

I'm hoping there may be some way to explicitly give camera ID's in VideoCapture(index) rather than just the generic 0 or 1 index. Any insight is greatly appreciated and or any other potential work arounds to prevent the error. Thank you!