Skip to main content

pyk4a

CI codecov

pyk4a

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.

Homepage: https://github.com/etiennedub/pyk4a/

Prerequisites

The Azure-Kinect-Sensor-SDK is required to build this library. To use the SDK, refer to the installation instructions here.

Install

Linux

Linux specific installation instructions here

Install both packages libk4a<major>.<minor> and libk4a<major>.<minor>-dev. The latter contains the headers and CMake files to build pyk4a.

Make sure your LD_LIBRARY_PATH contains the directory of k4a.lib

pip install pyk4a

Windows

In most cases pip install pyk4a is enough to install this package.

When using an anaconda environment, you need to set the environment variable CONDA_DLL_SEARCH_MODIFICATION_ENABLE=1 https://github.com/conda/conda/issues/10897

Because of the numerous issues received from Windows users, the installer (setup.py) automatically detects the kinect SDK path.

When the installer is not able to find the path, the following snippet can help. Make sure you replace the paths in these instructions with your own kinect 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"

During execution, k4a.dll is required. The automatic detection should be able to find this file. It is also possible to specify the DLL's directory with the environment variable K4A_DLL_DIR. If K4A_DLL_DIR is used, the automatic DLL search is not performed.

Example

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()
k4a.start()

# 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
plt.show()

Otherwise, a more avanced example is available in the example folder. To execute it opencv-python is required.

git clone https://github.com/etiennedub/pyk4a.git
cd pyk4a/example
python viewer.py

Documentation

No documentation is available but all functinos are properly type hinted. The code of the main class is a good place to startPyK4A.

You can also follow the various example folder scripts as reference.

Bug Reports

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.

Module Development

  1. Install required packages: make setup

  2. Install local pyk4a version (compiles pyk4a.cpp): make build

Contribution

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 build
make fmt lint
make test

Note: you need clang-format tool(v 11.0+) for formatting CPP code.

Release files for pyk4a-bundle 1.5.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for pyk4a-bundle 1.5.0.1
File
pyk4a_bundle-1.5.0.1-cp314-cp314t-win_amd64.whl CPython 3.14 CPython 3.14 free-threading Windows x86-64 Details
pyk4a_bundle-1.5.0.1-cp314-cp314t-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.38+ x86-64, Linux glibc 2.39+ x86-64 Details
pyk4a_bundle-1.5.0.1-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
pyk4a_bundle-1.5.0.1-cp314-cp314-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.39+ x86-64, Linux glibc 2.38+ x86-64 Details
pyk4a_bundle-1.5.0.1-cp313-cp313t-win_amd64.whl CPython 3.13 CPython 3.13 free-threading Windows x86-64 Details
pyk4a_bundle-1.5.0.1-cp313-cp313t-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl CPython 3.13 CPython 3.13 free-threading Linux glibc 2.39+ x86-64, Linux glibc 2.38+ x86-64 Details
pyk4a_bundle-1.5.0.1-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
pyk4a_bundle-1.5.0.1-cp313-cp313-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.39+ x86-64, Linux glibc 2.38+ x86-64 Details
pyk4a_bundle-1.5.0.1-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
pyk4a_bundle-1.5.0.1-cp312-cp312-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.39+ x86-64, Linux glibc 2.38+ x86-64 Details
pyk4a_bundle-1.5.0.1-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
pyk4a_bundle-1.5.0.1-cp311-cp311-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.38+ x86-64, Linux glibc 2.39+ x86-64 Details
pyk4a_bundle-1.5.0.1-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
pyk4a_bundle-1.5.0.1-cp310-cp310-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.39+ x86-64, Linux glibc 2.38+ x86-64 Details
pyk4a_bundle-1.5.0.1-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
pyk4a_bundle-1.5.0.1-cp39-cp39-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.39+ x86-64, Linux glibc 2.38+ x86-64 Details
pyk4a_bundle-1.5.0.1-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details
pyk4a_bundle-1.5.0.1-cp38-cp38-manylinux_2_39_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.39+ x86-64 Details

Total release size: 76.5 MB

Release files / pyk4a_bundle-1.5.0.1-cp314-cp314t-win_amd64.whl

Download URL pyk4a_bundle-1.5.0.1-cp314-cp314t-win_amd64.whl
Size 971.1 kB
Tags CPython 3.14 CPython 3.14 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
6a4c2b86f5202ba7cd6a98ece5564539fcdc1bd727bf834004bd847c77d172db
BLAKE2b-256 checksum
How to use checksums
b043cc950e621bfdf772b5e8b5750bf4e5109465fd29bae82270848b208a5e64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / pyk4a_bundle-1.5.0.1-cp314-cp314t-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl

Download URL pyk4a_bundle-1.5.0.1-cp314-cp314t-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl
Size 7.6 MB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.38+ x86-64 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
ee0fe097e5c2f86df79846faadafd878f1dca9a9fb3392b11f194a35e29fe8db
BLAKE2b-256 checksum
How to use checksums
3a59535a5327f4e4c2bfbdcac38fa9575f81d655a65726b220bc1786152d6472
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / pyk4a_bundle-1.5.0.1-cp314-cp314-win_amd64.whl

Download URL pyk4a_bundle-1.5.0.1-cp314-cp314-win_amd64.whl
Size 970.9 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
e76929e2b6787da216145e8aba182fd6827013b753021fc3803b58578a57f718
BLAKE2b-256 checksum
How to use checksums
58a2dcbc054574f5206d4bd6cb31c66d6176435fdf9f138e3ab2e96dc4ceacb0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / pyk4a_bundle-1.5.0.1-cp314-cp314-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl

Download URL pyk4a_bundle-1.5.0.1-cp314-cp314-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl
Size 7.6 MB
Tags CPython 3.14 Linux glibc 2.38+ x86-64 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
858f6a68b191bb90968fa839577bf9fa85ab2de693cd0e3d80fa090eaf333222
BLAKE2b-256 checksum
How to use checksums
314781ca7e8f7e1f16203f6325460ffb0d8e02ff3b0d4f91ea1fc18c7df1e5f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / pyk4a_bundle-1.5.0.1-cp313-cp313t-win_amd64.whl

Download URL pyk4a_bundle-1.5.0.1-cp313-cp313t-win_amd64.whl
Size 934.1 kB
Tags CPython 3.13 CPython 3.13 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
8e4c777669325a95971dd976daa0c2406babfa1c985278fc68205056d0740263
BLAKE2b-256 checksum
How to use checksums
3498a30baab9fac8129ccd9c3fa8b990646768c44c4b35655839ba8a54240304
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / pyk4a_bundle-1.5.0.1-cp313-cp313t-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl

Download URL pyk4a_bundle-1.5.0.1-cp313-cp313t-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl
Size 7.6 MB
Tags CPython 3.13 CPython 3.13 free-threading Linux glibc 2.38+ x86-64 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
2d745b5646e26c5973bf2488e76f80516aff78a0f2859dfad1d632658e6f7cd7
BLAKE2b-256 checksum
How to use checksums
a741f541806114b47da31c2edf099da1e5839989a80c181a7ecf0c8be246dd87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / pyk4a_bundle-1.5.0.1-cp313-cp313-win_amd64.whl

Download URL pyk4a_bundle-1.5.0.1-cp313-cp313-win_amd64.whl
Size 933.8 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
cbc2b809b5b52cb17ff1e6801873db438868de21984927bb7d6bd0a5cb93f14e
BLAKE2b-256 checksum
How to use checksums
bc7528dc00ba3a11d61d805470cbf3c639610dee643c9ee58e8a4d8eb29d1879
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / pyk4a_bundle-1.5.0.1-cp313-cp313-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl

Download URL pyk4a_bundle-1.5.0.1-cp313-cp313-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl
Size 7.6 MB
Tags CPython 3.13 Linux glibc 2.38+ x86-64 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
a52eb710af27549916b48602830a5b1f494c531ade49d470588769eef8bb6aeb
BLAKE2b-256 checksum
How to use checksums
1d8962c4e870567eb002c839b65334f82b735954651fe24e1b532e608bd26f50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / pyk4a_bundle-1.5.0.1-cp312-cp312-win_amd64.whl

Download URL pyk4a_bundle-1.5.0.1-cp312-cp312-win_amd64.whl
Size 933.8 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
8a1550a752d4858657ef0f68f06f4cb25edcd39380f837077157ad335962b0ec
BLAKE2b-256 checksum
How to use checksums
3e201684a995eaefb8364d288a1ba86e0081dccc18745966f34699118730b57b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / pyk4a_bundle-1.5.0.1-cp312-cp312-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl

Download URL pyk4a_bundle-1.5.0.1-cp312-cp312-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl
Size 7.6 MB
Tags CPython 3.12 Linux glibc 2.38+ x86-64 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
133d24971a3e5527e16a449a18da70210ac47fd68a9ca1ab38c7f1a7ab973047
BLAKE2b-256 checksum
How to use checksums
81807256cb094307fd34ec03ba0e7647af2a5d93da0d309e090524629eac68c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / pyk4a_bundle-1.5.0.1-cp311-cp311-win_amd64.whl

Download URL pyk4a_bundle-1.5.0.1-cp311-cp311-win_amd64.whl
Size 933.8 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
ad4a19aa1a3a28f397644d8b5f633a1750efb515c88334f9e16b7ae05c1f8b90
BLAKE2b-256 checksum
How to use checksums
176bde4ae0492332048a516e53ebcc06acc69ee277ac6fd65268dcb76e694087
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / pyk4a_bundle-1.5.0.1-cp311-cp311-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl

Download URL pyk4a_bundle-1.5.0.1-cp311-cp311-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl
Size 7.6 MB
Tags CPython 3.11 Linux glibc 2.38+ x86-64 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
e50097cd2cec55147001aa6f2063bc907071b1b7ed5a48417e217f2f25d95f47
BLAKE2b-256 checksum
How to use checksums
7c55baeedf94f2819aca3d56152e579726d4a21a3d95d84817cde0ef7175bee5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / pyk4a_bundle-1.5.0.1-cp310-cp310-win_amd64.whl

Download URL pyk4a_bundle-1.5.0.1-cp310-cp310-win_amd64.whl
Size 933.8 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
899d68c67a1853bd912ef9c413899805d18a23f46e1cfc396622ae09dfb569ad
BLAKE2b-256 checksum
How to use checksums
c92b870862d41956847460451b435ce4996fe72de50fb7df40286d39a1dce20c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / pyk4a_bundle-1.5.0.1-cp310-cp310-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl

Download URL pyk4a_bundle-1.5.0.1-cp310-cp310-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl
Size 7.6 MB
Tags CPython 3.10 Linux glibc 2.38+ x86-64 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
b9271f840b18e73d73e82e75dde5ecf4e6d3af92e3e4b976417d3d93e8631d06
BLAKE2b-256 checksum
How to use checksums
67db8fe45be023dfe1345529df1b439fe57193f2b9c382c06e97762c198bc216
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / pyk4a_bundle-1.5.0.1-cp39-cp39-win_amd64.whl

Download URL pyk4a_bundle-1.5.0.1-cp39-cp39-win_amd64.whl
Size 934.8 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
a259a3560ec55b35e9b1c03f12a14f6bccf8ec1c6eda6767efa42abfd82e3f3e
BLAKE2b-256 checksum
How to use checksums
9b4470c120dc28befa2590d77db8c6e530882cae6a1fa83478edb00e1697b1b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / pyk4a_bundle-1.5.0.1-cp39-cp39-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl

Download URL pyk4a_bundle-1.5.0.1-cp39-cp39-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl
Size 7.6 MB
Tags CPython 3.9 Linux glibc 2.38+ x86-64 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
1245f4accbe2b33aae12f2e889f2b5efeea1de8e54121734034510dfaa58cca5
BLAKE2b-256 checksum
How to use checksums
48bccc370250f0907a1f1095a5e9f1f03c93aaaeefe71f8174ed208a990944ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / pyk4a_bundle-1.5.0.1-cp38-cp38-win_amd64.whl

Download URL pyk4a_bundle-1.5.0.1-cp38-cp38-win_amd64.whl
Size 934.9 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
b27bdaad88ca73aace9529bb6b571607db726be8bcf687f413570abec97a26e0
BLAKE2b-256 checksum
How to use checksums
fa1e4b62ab556b329e5f0faca4e31289713d712759327dd9bc57045b22baff1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / pyk4a_bundle-1.5.0.1-cp38-cp38-manylinux_2_39_x86_64.whl

Download URL pyk4a_bundle-1.5.0.1-cp38-cp38-manylinux_2_39_x86_64.whl
Size 7.6 MB
Tags CPython 3.8 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
73e08a5ffd2ffe7e82011acee40b9496f1c85012558fbc7c1690c42e78b8db20
BLAKE2b-256 checksum
How to use checksums
d8aabf682e822e031e2f4dbf6a977a08e8779d8e55f7f4665c1bedcb92f79f6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

1.5.0.1 This release

18 release files

1.5.0

12 release files

1.3.0

10 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page