Skip to main content

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

Project description

pyusbcameraindex

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

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

PyPI PyPI - License PyPI - Python Version

PyPI - Downloads GitHub repo size

The pyusbcameraindex package enumerates USB video devices on Windows using DirectShow APIs.

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

Usage:

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()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyusbcameraindex-1.0.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyusbcameraindex-1.0.1-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file pyusbcameraindex-1.0.1.tar.gz.

File metadata

  • Download URL: pyusbcameraindex-1.0.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.15.1 CPython/3.11.9 Windows/10

File hashes

Hashes for pyusbcameraindex-1.0.1.tar.gz
Algorithm Hash digest
SHA256 88b1c42d7cb98745129f652140264b912f58976b917a6f285872ab9a3d06cd4c
MD5 ab34379c62942a9c98836c6b868528a8
BLAKE2b-256 0fdbbe5dbb838328c4bd7d74960f0fb8bc3ab6aea3f4ee3dd2e0578851d36fc1

See more details on using hashes here.

File details

Details for the file pyusbcameraindex-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyusbcameraindex-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.15.1 CPython/3.11.9 Windows/10

File hashes

Hashes for pyusbcameraindex-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e3fe457bf6085466912f952b7b9338ae5aed99684cb144fc7b1e591beb83dee8
MD5 df35c8da770f7549e685093f8f8f0c15
BLAKE2b-256 24fbac5b6197953f21b785b910905906278cfc0b286fda279987a47b03ae30cd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page