https://github.com/pupil-labs/pyv4l2
cython powered bindings for v4l2 capture
https://github.com/pupil-labs/pyv4l2
Last synced: 11 days ago
JSON representation
cython powered bindings for v4l2 capture
- Host: GitHub
- URL: https://github.com/pupil-labs/pyv4l2
- Owner: pupil-labs
- License: mit
- Created: 2014-09-09T21:59:20.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-05-08T14:39:36.000Z (almost 10 years ago)
- Last Synced: 2025-04-13T05:45:25.067Z (11 days ago)
- Language: Python
- Homepage:
- Size: 410 KB
- Stars: 10
- Watchers: 4
- Forks: 5
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
pyv4l2
=======Python bindings for Video4Linux2 API using [libjpegturbo](http://libjpeg-turbo.virtualgl.org/) (utilizing the tubojpeg api).
* 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 list_devices()
* 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
```python
import v4l2
cap = v4l2.Capture("/video/dev0")
print cap.frame_rates
frame = cap.get_frame()gray_numpy_array = frame.gray
bgr_numpy_array = frame.bgr
jpeg_buffer_handle = frame.jpeg_buffercap = None
```##Install
###dependecy libjpeg-turbo
Needs to be build with fpic!
Will be installed to `/opt/libjpeg-turbo`.```
sudo apt-get install nasm
wget -O libjpeg-turbo-1.3.90.tar.gz http://sourceforge.net/projects/libjpeg-turbo/files/1.3.90%20%281.4%20beta1%29/libjpeg-turbo-1.3.90.tar.gz/download
tar xvzf libjpeg-turbo-1.3.90.tar.gz
cd libjpeg-turbo-1.3.90
./configure --with-pic
sudo make install
```###dependecy cython
```
sudo pip install cython
```### just build locally
```
python setup.py build_ext -i
```### or install system wide
```
python setup.py install
```