项目作者: ykoneee

项目描述 :
A Python wrapper for Azure-Kinect-Sensor-SDK
高级语言:
项目地址: git://github.com/ykoneee/k4a-python.git
创建时间: 2019-10-24T06:55:25Z
项目社区:https://github.com/ykoneee/k4a-python

开源协议:MIT License

下载


Since my Azure-Kinect is broken, it will not be updated in the future.You can get the project source code from pypi.

k4a-python

PyPI
This library is a wrapper in Python for Azure-Kinect-Sensor-SDK

  • depth\color\ir image numpy data
  • depth (colorize)
  • depth to color transform
  • IMU data
  • read camera setting
  • set camera setting
  • some trivial functions, such as get_installed_count

    Prereqs

Install

Linux

  1. pip install k4a-python

pip install only have test on ubuntu 18.04, but it should aslo work well with other linux distributions.

Windows

pip on windows has not been tested, will test as soon.

TODO

  • other official c++ API
  • other official modules, like k4arecord
  • official example
  • Microphone data

    Usage

    The Python API mainly refers to the official C + + API
    (Will have better example)
    dirty example code :
    ```
    import pyk4a
    import cv2
    import numpy as np

print(pyk4a.Device.get_installed_count())
device=pyk4a.Device.open(pyk4a.K4A_DEVICE_DEFAULT)
print(device.get_serialnum())
config = pyk4a.Configuration()
config.depth_mode = pyk4a.K4A_DEPTH_MODE_WFOV_2X2BINNED
config.color_resolution = pyk4a.K4A_COLOR_RESOLUTION_720P
config.camera_fps = pyk4a.K4A_FRAMES_PER_SECOND_30
config.color_format = pyk4a.K4A_IMAGE_FORMAT_COLOR_BGRA32
config.synchronized_images_only = True

calibration = device.get_calibration(config.depth_mode, config.color_resolution)
transformation = pyk4a.Transformation(calibration)
device.start_cameras(config)
device.start_imu()
capture=pyk4a.Capture()

a=10
while a>0:
a-=1
print(a)

  1. if device.get_capture(capture,1000):
  2. img=capture.get_color_image()
  3. # img=transformation.depth_image_to_color_camera(img)
  4. # print(img.get_device_timestamp())
  5. print(device.get_raw_calibration())
  6. img=img.numpy()
  7. # state=device.get_imu_sample()
  8. # print(state)
  9. cv2.imshow('t',img)
  10. cv2.waitKey(1)

```