Skip to content
Advertisement

How to make USB camera work with OpenCV?

I copied code from https://stackoverflow.com/a/34588758/210342 and used with default (built-in) camera, it worked. Then I attached USB camera, tested it with VLC and changed the code to open camera 1:

cam = cv2.VideoCapture(1)

I check whether the camera is open cam.isOpened() — it is — but the camera is not enabled (its hardware indicator, LED, is off) and indeed all I see on the screen is black frame.

Is there some extra special code to add in order to enable USB camera?

Advertisement

Answer

Are you sure the usb camera is camera 1, i’ve done this before and had to use cv2.VideoCapture(0)

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement