Skip to main content

Usb Video Class Device bindings with format conversion tool

Project description

https://img.shields.io/pypi/v/pupil-labs-uvc.svg https://img.shields.io/pypi/pyversions/pupil-labs-uvc.svg tests Code style: Black https://img.shields.io/badge/skeleton-2022-informational

pyuvc

Python bindings for the Pupil Labs fork of libuvc with super fast jpeg decompression using libjpegturbo (utilizing the tubojpeg api).

  • cross platform access to UVC capture devices.

  • Full access to all uvc settings (Zoom,Focus,Brightness,etc.)

  • Full access to all stream and format parameters (rates,sizes,etc.)

  • Enumerate all capture devices with device_list()

  • Capture instance will always grab mjpeg conpressed frames from cameras.

Image data is returned as Frame object. This object will decompress and convert on the fly when image data is requested. This gives the user the full flexiblity: Grab just the jpeg buffers or have them converted to YUV or Gray or RGB and only when you need.

The Frame class has caching build in to avoid double decompression or conversion.

Install via PyPI

pip install pupil-labs-uvc

Example

See examples/ for code examples.

Install from source

pyuvc requires the following dependencies:

Once the dependencies are installed, you can pip install the source tree:

git clone https://github.com/pupil-labs/pyuvc --recursive
export FORCE_LOCAL_LIBUVC_BUILD=ON
pip install ./pyuvc

Linux

Ubuntu/Debian:

apt-get update -y
apt-get install -y libusb-1.0-0-dev libturbojpeg-dev
Running as a non-root user

One needs to setup udev rules and add the target user to the plugdev group to avoid the privileged access requirement.

echo 'SUBSYSTEM=="usb",  ENV{DEVTYPE}=="usb_device", GROUP="plugdev", MODE="0664"' | sudo tee /etc/udev/rules.d/10-libuvc.rules > /dev/null
sudo udevadm trigger
sudo usermod -a -G plugdev $USER
# logout and back in

macOS

Homebrew:

brew update
brew install libusb jpeg-turbo
Running as a non-root user

Unfortunately, this is currently not possible. See this libusb issue thread for details.

WINDOWS

Run the following code in a powershell to install the dependencies (requires 7z to be installed)

pip install build delvewheel
git clone https://github.com/pupil-labs/pyuvc --recursive
cd pyuvc
scripts/download-deps-win.ps1 -DEPS_TMP_PATH tmp
$Env:DEPS_PATHS_LOC = "tmp/dep_paths.json"
python -m build -w   # will create a wheel in dist/ folder; insert the wheel path below
python scripts/repair-wheels-win.py $Env:DEPS_PATHS_LOC <wheel location> wheelhouse
pip install wheelhouse/<wheel name>
Manual driver installation

pyuvc requires the libUSBk driver to be installed for your corresponding camera. Otherwise, metadata like the product name will be set to "unknown".

Please see these instructions on how to manually install libUSBk drivers for your specific camera.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

pupil_labs_uvc-1.0.0-cp311-cp311-win_amd64.whl (996.1 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

pupil_labs_uvc-1.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pupil_labs_uvc-1.0.0-cp311-cp311-macosx_10_9_x86_64.whl (669.1 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pupil_labs_uvc-1.0.0-cp310-cp310-win_amd64.whl (996.1 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

pupil_labs_uvc-1.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pupil_labs_uvc-1.0.0-cp310-cp310-macosx_10_9_x86_64.whl (669.6 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pupil_labs_uvc-1.0.0-cp39-cp39-win_amd64.whl (996.8 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

pupil_labs_uvc-1.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pupil_labs_uvc-1.0.0-cp39-cp39-macosx_10_9_x86_64.whl (669.7 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pupil_labs_uvc-1.0.0-cp38-cp38-win_amd64.whl (997.1 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

pupil_labs_uvc-1.0.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

pupil_labs_uvc-1.0.0-cp38-cp38-macosx_10_9_x86_64.whl (668.4 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

pupil_labs_uvc-1.0.0-cp37-cp37m-win_amd64.whl (992.6 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

pupil_labs_uvc-1.0.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

pupil_labs_uvc-1.0.0-cp37-cp37m-macosx_10_9_x86_64.whl (658.0 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

pupil_labs_uvc-1.0.0-cp36-cp36m-win_amd64.whl (991.3 kB view hashes)

Uploaded CPython 3.6m Windows x86-64

pupil_labs_uvc-1.0.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.17+ x86-64

pupil_labs_uvc-1.0.0-cp36-cp36m-macosx_10_9_x86_64.whl (655.7 kB view hashes)

Uploaded CPython 3.6m macOS 10.9+ x86-64

Supported by

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