Python wrapper over Azure Kinect SDK
This library is a simple and pythonic wrapper in Python 3 for the Azure-Kinect-Sensor-SDK.
Images are returned as numpy arrays and behave like python objects.
This approach incurs almost no overhead in terms of CPU, memory or other resources. It also simplifies usage. Kinect C api image buffers are directly reused and image releases are performed automatically by the python garbage collector.
Make sure your
LD_LIBRARY_PATH contains the directory of k4a.lib
pip install pyk4a
Make sure you replace the paths in the following instructions with your own k4a sdk path.
It is important to replace
1.4.1 with your installed version of the SDK.
pip install pyk4a --no-use-pep517 --global-option=build_ext --global-option="-IC:\Program Files\Azure Kinect SDK v1.4.1\sdk\include" --global-option="-LC:\Program Files\Azure Kinect SDK v1.4.1\sdk\windows-desktop\amd64\release\lib"
Don't forget to add the folder containing the release
k4a.dll to your Path env variable
C:\Program Files\Azure Kinect SDK v1.2.0\sdk\windows-desktop\amd64\release\bin
For a basic example displaying the first frame, you can run this code:
from pyk4a import PyK4A
# Load camera with the default config
k4a = PyK4A()
# Get the next capture (blocking function)
capture = k4a.get_capture()
img_color = capture.color
# Display with pyplot
from matplotlib import pyplot as plt
plt.imshow(img_color[:, :, 2::-1]) # BGRA to RGB
git clone https://github.com/etiennedub/pyk4a.git
No documentation is available but most methods are used in the example. You can follow it as reference. You can also check directly the code of the main class PyK4A.
Submit an issue and please include as much details as possible.
Make sure to use the search function on closed issues, especially if your problem is related to installing on windows.
Install required packages:
Install local pyk4a version (compiles pyk4a.cpp):
Feel free to send pull requests. The develop branch should be used.
Please rebuild, format, check code quality and run tests before submitting a pull request:
make fmt lint
Note: you need
clang-format tool(v 11.0+) for formatting CPP code.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.