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’