Metadata-Version: 2.1
Name: pyusbcameraindex
Version: 1.0.1
Summary: Identify and select your USB cameras in Python for use with OpenCV.
Keywords: opencv,python,usb,directshow,index
Author: John Hardy
License: Copyright 2024 (Dr. John Hardy)
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: Microsoft :: Windows
Project-URL: Homepage, https://github.com/JohnHardy/pyusbcameraindex
Project-URL: Repository, https://github.com/JohnHardy/pyusbcameraindex
Project-URL: Bug tracker, https://github.com/JohnHardy/pyusbcameraindex/issues
Requires-Python: >=3.10
Requires-Dist: comtypes>=1.4.4
Requires-Dist: pywin32>=306
Description-Content-Type: text/markdown

<div align="center">

# pyusbcameraindex

Identify and select your USB cameras in Python for use with OpenCV.

 🚀🤯 Stop guessing the camera index in OpenCV! 🤯🚀

[![PyPI](https://img.shields.io/pypi/v/pyusbcameraindex?logo=python&logoColor=%23cccccc)](https://pypi.org/project/pyusbcameraindex)
![PyPI - License](https://img.shields.io/pypi/l/pyusbcameraindex)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pyusbcameraindex)

![PyPI - Downloads](https://img.shields.io/pypi/dm/pyusbcameraindex)
![GitHub repo size](https://img.shields.io/github/repo-size/JohnHardy/pyusbcameraindex)

</div>

The [pyusbcameraindex](https://github.com/JohnHardy/pyusbcameraindex) package enumerates USB video devices on *Windows* using DirectShow APIs.

Linux and Mac are not supported, but pull requests are welcome.

Usage:
```python
import cv2
from pyusbcameraindex import enumerate_usb_video_devices_windows

# List the devices.
devices = enumerate_usb_video_devices_windows()
for device in devices:
    print(f"{device.index} == {device.name} (VID: {device.vid}, PID: {device.pid}, Path: {device.path}")

# Show a frame from each.
for device in devices:
    cap = cv2.VideoCapture(device.index, cv2.CAP_DSHOW)
    ret, frame = cap.read()
    cv2.imshow(f"Device={device.name}", frame)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
    cap.release()
cv2.destroyAllWindows()
```
