Reputation: 4187
In python you can do
import cv2
cap = cv2.VideoCapture(index)
to open a webcam at index
where index
is a number ranging from 0,1,2,3...
But if I have multiple cameras and the order is arbitrary, my camera accessing code will be unreliable.
Is there a way to open a specific camera with a name or ID using OpenCV on Windows 10? How to do it?
Upvotes: 2
Views: 4078
Reputation: 4187
I used this library and it seems to work: https://github.com/pvys/CV-camera-finder
Might be interesting to check this too: https://github.com/econsystems/opencv
Upvotes: 1
Reputation: 1
You can start looking at udev rules for linux and the look the windows equivalent for the same.
udev rules lets you configure usb devices, as soon as they are connected to the port, using unique attributes stored on the device such as vendor ID, serial number, product ID etc.
Upvotes: 0