OpenCV VideoCapture device index / device number
If you can differentiate the cameras by their serial number or device and vendor id, you can loop through all video devices before opening with opencv and search for the camera device you want to open.
I have a python environment (on Windows 10) that uses OpenCV VideoCapture class to connect to multiple usb cameras.
As far as I know, there is no way to identify a specific camera in OpenCV other than the device parameter in the VideoCapture class constructor / open method.
The problem is that the device parameter changes depending on how many cameras are actually connected and to which usb ports.
I want to be able to identify a specific camera and find its "device index" or "camera index" no matter how many cameras are connected and to which usb ports.
Can somebody please suggest a way to achieve that functionality? python code is preferable but C++ will also do.