Open usb camera using name instead of index in openCV3.2
Hi all,
I have an issue with my USB camera. When I plug it into my system, it creates two different links: /dev/video0 and /dev/video1. Sometimes, it happens that the video frames are indifferently passed to index 0 or index 1.
I know how to detect the correct video source an, for this reason, I create a virtual video device that is a map of that source.
Now, I would like to know if it is possible to call the VideoCapture function, passing directly the name of the device, e.g., /dev/videoMine instead of the index.
I already tried something like:
VideoCapture cap("/dev/videoMine", CAP_V4L);
but it does not work.
thanks
I don't think it is possible if I understand well doc
videoMine is folder or filename? But this should be
CAP_V4L2
instead ofCAP_V4L
?videoMine is the name of the device I re-mapped.... suppose /dev/video0 in /dev/videoMine
Try to open
/dev/v4l/by-id/[camera-id]
.mmm...@kbarni, in this way I have to know the cam id...by the way, it does not work
Normally a webcam should create a single device (like /dev/video0). It also creates links to this device using the device ID and the connection port (these might be useful if you want to identify a particular device when several cameras are connected - e.g. you want to do stereo vision and don't know if the video0 is the left or right camera).
In OpenCV you can use any of these solutions to open the camera:
Tested all and working. If you have problems, maybe the problem is elsewhere.