I have 2 identical ELP USB 3.0 cameras. I'm trying to get both working with opencv/python on Windows 10, but only one of the connected cameras ever returns an image. Specifically, using code like the following:
cam = cv2.VideoCapture(1)
while True:
ret, img = cam.read()
if not ret:
print('Capture failed')
break
cv2.imshow('test', img)
k = cv2.waitKey(1)
if k == ord('k'):
break
cam.release()
only shows a video if I use 1 in cv2.VideoCapture(1)
. Looping through different camera numbers (0-500) and printing the return value of a camera.read()
only shows True on camera number 1. In other words, opencv does not seem to see the second camera at all. I tested the cameras individually using the Windows "Camera" program, and can successfully swap between the two cameras there, so both work. Also, I've tested the cameras previously on a different Linux machine, and they also both worked with opencv (though not simultaneously, which is a totally different issue) as cameras 0 and 1. Does anyone know what might be wrong?