Giter VIP home page Giter VIP logo

pyuvc's Introduction

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.

pyuvc's People

Contributors

papr avatar mkassner avatar jaraco avatar manasi94 avatar willpatera avatar pre-commit-ci[bot] avatar webknjaz avatar domstoppable avatar abravalheri avatar romanroibu avatar ianphilips avatar darkvertex avatar ostenh avatar bjornborg avatar bhrutledge avatar cjmayo avatar dourvaris avatar hugovk avatar kolanich avatar marc-tonsen avatar patrickfuerst avatar cpicanco avatar gmierz avatar wimglenn avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.