oldbane / freenect2-python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

freenect2: Python bindings to libfreenect2

https://travis-ci.org/rjw57/freenect2-python.svg?branch=master

The freenect2 module provides a Python interface to the libfreenect2 library. The libfreenect2 library provides a library allowing depth and RGB data to be extracted from a Kinect for Windows v2 (K4W2) device.

If using this library in an academic context, please use the DOI linked above.

Although a lot of libfreenect2 functionality is exposed, simple "single grab" usage of freenect2 should be simple. For example, here is how to grab a single depth frame and save it to a grayscale JPEG:

from PIL.ImageMath import eval as im_eval
from freenect2 import Device, FrameType

device = Device()
with device.running():
    for frame_type, frame in device:
        if frame_type is FrameType.Depth:
            # Convert range of depth image to 0->255.
            norm_im = im_eval('convert(I / 16, "L")', I=frame.to_image())
            norm_im.save('depth.jpg')
            break

Getting started

Installation instructions and reference documentation are available on the associated documentation pages.

About

License:MIT License


Languages

Language:Python 74.7%Language:C++ 25.3%