Skip to main content

Python wrapper over Azure Kinect SDK

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyk4a_bundle-1.5.0.1-cp314-cp314t-win_amd64.whl (971.1 kB view details)

Uploaded CPython 3.14tWindows x86-64

pyk4a_bundle-1.5.0.1-cp314-cp314t-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl (7.6 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.38+ x86-64manylinux: glibc 2.39+ x86-64

pyk4a_bundle-1.5.0.1-cp314-cp314-win_amd64.whl (970.9 kB view details)

Uploaded CPython 3.14Windows x86-64

pyk4a_bundle-1.5.0.1-cp314-cp314-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl (7.6 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.38+ x86-64manylinux: glibc 2.39+ x86-64

pyk4a_bundle-1.5.0.1-cp313-cp313t-win_amd64.whl (934.1 kB view details)

Uploaded CPython 3.13tWindows x86-64

pyk4a_bundle-1.5.0.1-cp313-cp313t-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl (7.6 MB view details)

Uploaded CPython 3.13tmanylinux: glibc 2.38+ x86-64manylinux: glibc 2.39+ x86-64

pyk4a_bundle-1.5.0.1-cp313-cp313-win_amd64.whl (933.8 kB view details)

Uploaded CPython 3.13Windows x86-64

pyk4a_bundle-1.5.0.1-cp313-cp313-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl (7.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.38+ x86-64manylinux: glibc 2.39+ x86-64

pyk4a_bundle-1.5.0.1-cp312-cp312-win_amd64.whl (933.8 kB view details)

Uploaded CPython 3.12Windows x86-64

pyk4a_bundle-1.5.0.1-cp312-cp312-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl (7.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.38+ x86-64manylinux: glibc 2.39+ x86-64

pyk4a_bundle-1.5.0.1-cp311-cp311-win_amd64.whl (933.8 kB view details)

Uploaded CPython 3.11Windows x86-64

pyk4a_bundle-1.5.0.1-cp311-cp311-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl (7.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.38+ x86-64manylinux: glibc 2.39+ x86-64

pyk4a_bundle-1.5.0.1-cp310-cp310-win_amd64.whl (933.8 kB view details)

Uploaded CPython 3.10Windows x86-64

pyk4a_bundle-1.5.0.1-cp310-cp310-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl (7.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.38+ x86-64manylinux: glibc 2.39+ x86-64

pyk4a_bundle-1.5.0.1-cp39-cp39-win_amd64.whl (934.8 kB view details)

Uploaded CPython 3.9Windows x86-64

pyk4a_bundle-1.5.0.1-cp39-cp39-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl (7.6 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.38+ x86-64manylinux: glibc 2.39+ x86-64

pyk4a_bundle-1.5.0.1-cp38-cp38-win_amd64.whl (934.9 kB view details)

Uploaded CPython 3.8Windows x86-64

pyk4a_bundle-1.5.0.1-cp38-cp38-manylinux_2_39_x86_64.whl (7.6 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.39+ x86-64

File details

Details for the file pyk4a_bundle-1.5.0.1-cp314-cp314t-win_amd64.whl.

File metadata

File hashes

Hashes for pyk4a_bundle-1.5.0.1-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 6a4c2b86f5202ba7cd6a98ece5564539fcdc1bd727bf834004bd847c77d172db
MD5 eb665b005b2677fe41775f3f55a1dcb1
BLAKE2b-256 b043cc950e621bfdf772b5e8b5750bf4e5109465fd29bae82270848b208a5e64

See more details on using hashes here.

File details

Details for the file pyk4a_bundle-1.5.0.1-cp314-cp314t-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pyk4a_bundle-1.5.0.1-cp314-cp314t-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 ee0fe097e5c2f86df79846faadafd878f1dca9a9fb3392b11f194a35e29fe8db
MD5 9d65e00f185f7773919405693c0bb32f
BLAKE2b-256 3a59535a5327f4e4c2bfbdcac38fa9575f81d655a65726b220bc1786152d6472

See more details on using hashes here.

File details

Details for the file pyk4a_bundle-1.5.0.1-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for pyk4a_bundle-1.5.0.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 e76929e2b6787da216145e8aba182fd6827013b753021fc3803b58578a57f718
MD5 ba6af735bfb77d7fc0cd49b787acd88f
BLAKE2b-256 58a2dcbc054574f5206d4bd6cb31c66d6176435fdf9f138e3ab2e96dc4ceacb0

See more details on using hashes here.

File details

Details for the file pyk4a_bundle-1.5.0.1-cp314-cp314-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pyk4a_bundle-1.5.0.1-cp314-cp314-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 858f6a68b191bb90968fa839577bf9fa85ab2de693cd0e3d80fa090eaf333222
MD5 3b00e92d7b40d68e94e37f2e885b6198
BLAKE2b-256 314781ca7e8f7e1f16203f6325460ffb0d8e02ff3b0d4f91ea1fc18c7df1e5f9

See more details on using hashes here.

File details

Details for the file pyk4a_bundle-1.5.0.1-cp313-cp313t-win_amd64.whl.

File metadata

File hashes

Hashes for pyk4a_bundle-1.5.0.1-cp313-cp313t-win_amd64.whl
Algorithm Hash digest
SHA256 8e4c777669325a95971dd976daa0c2406babfa1c985278fc68205056d0740263
MD5 d21e507b6b03082e9c63ba8dab2d05d9
BLAKE2b-256 3498a30baab9fac8129ccd9c3fa8b990646768c44c4b35655839ba8a54240304

See more details on using hashes here.

File details

Details for the file pyk4a_bundle-1.5.0.1-cp313-cp313t-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pyk4a_bundle-1.5.0.1-cp313-cp313t-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 2d745b5646e26c5973bf2488e76f80516aff78a0f2859dfad1d632658e6f7cd7
MD5 e51eeb412a1f63de7fe30dba8f334fbe
BLAKE2b-256 a741f541806114b47da31c2edf099da1e5839989a80c181a7ecf0c8be246dd87

See more details on using hashes here.

File details

Details for the file pyk4a_bundle-1.5.0.1-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyk4a_bundle-1.5.0.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 cbc2b809b5b52cb17ff1e6801873db438868de21984927bb7d6bd0a5cb93f14e
MD5 3c2472fb6349f9f5465a26fb932ba773
BLAKE2b-256 bc7528dc00ba3a11d61d805470cbf3c639610dee643c9ee58e8a4d8eb29d1879

See more details on using hashes here.

File details

Details for the file pyk4a_bundle-1.5.0.1-cp313-cp313-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pyk4a_bundle-1.5.0.1-cp313-cp313-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 a52eb710af27549916b48602830a5b1f494c531ade49d470588769eef8bb6aeb
MD5 757e316dc53499f3c5421b74f9a73b4a
BLAKE2b-256 1d8962c4e870567eb002c839b65334f82b735954651fe24e1b532e608bd26f50

See more details on using hashes here.

File details

Details for the file pyk4a_bundle-1.5.0.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyk4a_bundle-1.5.0.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8a1550a752d4858657ef0f68f06f4cb25edcd39380f837077157ad335962b0ec
MD5 bd996ab6e1ec5fd135feeb04ecb1a479
BLAKE2b-256 3e201684a995eaefb8364d288a1ba86e0081dccc18745966f34699118730b57b

See more details on using hashes here.

File details

Details for the file pyk4a_bundle-1.5.0.1-cp312-cp312-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pyk4a_bundle-1.5.0.1-cp312-cp312-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 133d24971a3e5527e16a449a18da70210ac47fd68a9ca1ab38c7f1a7ab973047
MD5 6dffe5d5bf27836e68be08cf253dd387
BLAKE2b-256 81807256cb094307fd34ec03ba0e7647af2a5d93da0d309e090524629eac68c9

See more details on using hashes here.

File details

Details for the file pyk4a_bundle-1.5.0.1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyk4a_bundle-1.5.0.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ad4a19aa1a3a28f397644d8b5f633a1750efb515c88334f9e16b7ae05c1f8b90
MD5 4f09fc790cfdc8fb8ba5f1f87a9f56f9
BLAKE2b-256 176bde4ae0492332048a516e53ebcc06acc69ee277ac6fd65268dcb76e694087

See more details on using hashes here.

File details

Details for the file pyk4a_bundle-1.5.0.1-cp311-cp311-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pyk4a_bundle-1.5.0.1-cp311-cp311-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 e50097cd2cec55147001aa6f2063bc907071b1b7ed5a48417e217f2f25d95f47
MD5 72bef3232d71d4716fd3396f476ef659
BLAKE2b-256 7c55baeedf94f2819aca3d56152e579726d4a21a3d95d84817cde0ef7175bee5

See more details on using hashes here.

File details

Details for the file pyk4a_bundle-1.5.0.1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyk4a_bundle-1.5.0.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 899d68c67a1853bd912ef9c413899805d18a23f46e1cfc396622ae09dfb569ad
MD5 0f8d68142b7bf7e1e41dbc49da940584
BLAKE2b-256 c92b870862d41956847460451b435ce4996fe72de50fb7df40286d39a1dce20c

See more details on using hashes here.

File details

Details for the file pyk4a_bundle-1.5.0.1-cp310-cp310-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pyk4a_bundle-1.5.0.1-cp310-cp310-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 b9271f840b18e73d73e82e75dde5ecf4e6d3af92e3e4b976417d3d93e8631d06
MD5 4cb685be4036c4e6eb50d252142dc60c
BLAKE2b-256 67db8fe45be023dfe1345529df1b439fe57193f2b9c382c06e97762c198bc216

See more details on using hashes here.

File details

Details for the file pyk4a_bundle-1.5.0.1-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyk4a_bundle-1.5.0.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 a259a3560ec55b35e9b1c03f12a14f6bccf8ec1c6eda6767efa42abfd82e3f3e
MD5 25f182001d62546d65a62c480a28f6a5
BLAKE2b-256 9b4470c120dc28befa2590d77db8c6e530882cae6a1fa83478edb00e1697b1b2

See more details on using hashes here.

File details

Details for the file pyk4a_bundle-1.5.0.1-cp39-cp39-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pyk4a_bundle-1.5.0.1-cp39-cp39-manylinux_2_38_x86_64.manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 1245f4accbe2b33aae12f2e889f2b5efeea1de8e54121734034510dfaa58cca5
MD5 a19cd87f219e8dd0964165527423824a
BLAKE2b-256 48bccc370250f0907a1f1095a5e9f1f03c93aaaeefe71f8174ed208a990944ce

See more details on using hashes here.

File details

Details for the file pyk4a_bundle-1.5.0.1-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyk4a_bundle-1.5.0.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 b27bdaad88ca73aace9529bb6b571607db726be8bcf687f413570abec97a26e0
MD5 f2ab2a72753b1ab45d8d5c618a520fca
BLAKE2b-256 fa1e4b62ab556b329e5f0faca4e31289713d712759327dd9bc57045b22baff1c

See more details on using hashes here.

File details

Details for the file pyk4a_bundle-1.5.0.1-cp38-cp38-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pyk4a_bundle-1.5.0.1-cp38-cp38-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 73e08a5ffd2ffe7e82011acee40b9496f1c85012558fbc7c1690c42e78b8db20
MD5 68327c4558631f3ab9a6ea316a8f4550
BLAKE2b-256 d8aabf682e822e031e2f4dbf6a977a08e8779d8e55f7f4665c1bedcb92f79f6f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page