Git Product home page Git Product logo

pyuvc's Introduction

pyuvc

Python bindings for 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.

Example

import uvc
import logging
logging.basicConfig(level=logging.INFO)

dev_list =  uvc.device_list()
print dev_list
cap = uvc.Capture(dev_list[0]['uid'])
print cap.avaible_modes
cap.print_info()
for x in range(10):
	print x
	cap.frame_mode = (640,480,30)
	for x in range(100):
		frame = cap.get_frame_robust()
		print frame.img.shape
		#cv2.imshow("img",frame.gray)
		#cv2.waitKey(1)
cap = None

Dependencies Linux

libuvc

git clone https://github.com/pupil-labs/libuvc
cd libuvc
mkdir build
cd build
cmake ..
make && sudo make install
sudo ldconfig

libjpeg-turbo

wget -O libjpeg-turbo.tar.gz https://sourceforge.net/projects/libjpeg-turbo/files/1.5.1/libjpeg-turbo-1.5.1.tar.gz/download
tar xvzf libjpeg-turbo.tar.gz
cd libjpeg-turbo-1.5.1
./configure --with-pic --prefix=/usr/local
sudo make install
sudo ldconfig

cython

sudo pip install cython

udev rules for running as normal user:

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

Dependencies Mac

libuvc

git clone https://github.com/pupil-labs/libuvc
cd libuvc
mkdir build
cd build
cmake ..
make && sudo make install

libjpeg-turbo

brew install libjpeg-turbo

cython,numpy

pip install cython
pip install numpy

just build locally

python setup.py build_ext -i

or install system wide

python setup.py install

WINDOWS

Please have a look at WINDOWS_USER.md for install instructions if you want to use PYUVC. Please have a look at WINDOWS_DEVELOER.md for install instructions if you want to modify PYUVC.

pyuvc's People

Contributors

mkassner avatar manasi94 avatar willpatera avatar ostenh avatar papr avatar patrickfuerst avatar

Watchers

 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.