OpenCV does not recognize USB cameras by indices

Hello, I’m trying to run an USB 3.0 camera (AlliedVision Mako U 051-B) with OpenCV, but I only can run the integrated webcam in my notebook with cv2.VideoCapture(0). I tried with another indices (1, 2, 3, 4, 5, 6, etc.) and nothing succeed. I don’t know if I have to install any complement for OpenCV to recognize external cameras. I have OpenCV version 4.10.0 installed by: pip install opencv-python. Below I show my code. Thanks for the help!

import cv2

capture = cv2.VideoCapture(1)

while True:
	ret, video = capture.read()
	video = cv2.flip(video, 1)
	cv2.imshow('Video', video)
	cv2.moveWindow('Video', 200, 200)
	if cv2.waitKey(1) == ord('q'):
		break

capture.release()
cv2.destroyAllWindows()

The error message is as follows:

[ WARN:0@0.016] global cap_v4l.cpp:999 open VIDEOIO(v4L2:/dev/video1): can’t open camera by index
[ERROR:0@0.155] global obsensor_uvc_stream_channel.cpp:158 getStreamChannelGroup Camera index out of range
File " ", line 8, in module
cv2.imshow(‘Video’, video)
cv2.error: OpenCV(4.10.0) /io/opencv/modules/highgui/src/window.cpp:973: error: (-215:Assertion failed) size.width>0 && size.height>0 in function ‘imshow’

that’s not a regular USB camera, that’s “USB3 Vision”

if you’re lucky, Allied Vision have a driver that exposes the camera as a V4L2 device.

Or maybe you can switch it into a USB Unified Video Class (UVC) mode?

in general, you’ll have to use the manufacturer’s driver. otherwise, you might have to deal with a library and/or source code that you will have to use in your program.

you can check if your opencv was built "WITH_XIMEA", which is another manufacturer’s driver for their USB3 Vision devices. it might work (or not) for yours. print cv.getBuildInformation() to get some details.