I am working on a project that has to detect a USB camera (CM3-U3-13S2C-CS a 1.3 Megapixel USB 3.0 camera), opencv failed to detect the id of the camera I have tried the code below to display the IDS of available cameras but all that openCV detects is the ID of the webcam, the camera is working fine on Labview. I would really appreciate any help !
> import cv2
>
> openCvVidCapIds = []
>
> for i in range(100):
> try:
> cap = cv2.VideoCapture(i)
> if cap is not None and cap.isOpened():
> openCvVidCapIds.append(i)
> # end if
> except:
> pass
> # end try
> # end for
>
> print(str(openCvVidCapIds))
CodePudding user response:
which OS are you running your OpenCV codes? have you checked if your USB camera is shown up in your OS device layers?
for windows, in the Device Manager under the "Imaging devices" tree
for Linux, in /dev like "/dev/video1" and "/dev/video2" and then do
cap = cv2.VideoCapture("/dev/videox")