0

The question is complete in itself. Adding a few more details to include the things which I have already tried:

  • I have searched across stackexchange platform, but was unable to get my query solved.
  • Through some clues which I gathered along the way, I could only count the number of connected devices.

VideoCapture class has been mentioned in some posts, but that was only so much useful.

I am working on Windows platform with C++.

Sankalp
  • 2,796
  • 3
  • 30
  • 43
  • Answered [here](http://stackoverflow.com/questions/34197825/c-opencv-2-4-11-list-all-cameras). – pSoLT Jan 20 '17 at 08:18
  • Yes. But, there it's mentioned that this is unsolved and the post is an year old. I would like to know the current status and if it's possible now. – Sankalp Jan 20 '17 at 08:30
  • Did you read the answer ? Maybe it's god idea to post what version of OpenCV you are using if you want someone to check it for you. – pSoLT Jan 20 '17 at 08:32

1 Answers1

0

I created this C++ class that allows you to enumerate the devices (including ID) that you can use in order to get the list of devices to use in OpenCV. It is hosted on GitHub

https://github.com/studiosi/OpenCVDeviceEnumerator

The idea is to use DirectShow to get all the devices that have the category with GUID CLSID_VideoInputDeviceCategory, and then, through an enumerator, you get in which order they appear on the system, which is the ID you need to open them on OpenCV by creating a VideoCapture object (by using the constructor that receives the ID, which would be the index of the device on the enumeration). Obviously, this approach only works on Windows.

dagilpe
  • 147
  • 1
  • 14