A Python API for interfacing with the Kinect2.
pip install https://github.com/sshh12/LibKinect2/releases/download/v0.1.0/libkinect2-0.1.0.tar.gz
from libkinect2 import Kinect2
from libkinect2.utils import depth_map_to_image
import numpy as np
import cv2
# Init Kinect2 w/2 sensors
kinect = Kinect2(use_sensors=['color', 'depth'])
kinect.connect()
kinect.wait_for_worker()
for _, color_img, depth_map in kinect.iter_frames():
# Display color and depth data
cv2.imshow('color', color_img)
cv2.imshow('depth', depth_map_to_image(depth_map))
key = cv2.waitKey(1) & 0xFF
if key == ord('q'):
break
kinect.disconnect()
For python docs, run:
from libkinect2 import Kinect2
help(Kinect2)
I'm sure there are plenty of issues, so fill free to create one or fix one.
There's a whole bunch of these...