OpenCV does not have an API for listing capture devices. The sample shows how to create a Python extension to invoke DirectShow C++ APIs for enumerating capture devices.
- Microsoft Windows SDK
- Python 2.7.9 / Python 3.6.5
- OpenCV 3.3.0
-
Build the Python extension:
Python 2
python setup.py build install
Python 3
python3 setup.py build install
-
Run the app and select a capture device:
Python 2
python test.py
Python 3
python3 test.py