Skip to main content

Open Azure Kinect recordings without the Azure Kinect SDK.

Project description

Open Azure Kinect PyPI

Easy-to-use playback library for Azure Kinect MKV files.

Calibration Example

Calibration Example

It is possible to playback Azure Kinect videos files (mkv) without using the official SDK. This allows the software to be used on systems where the depth engine is not implemented, such as MacOS. The library currently only supports the playback of mkv files and does not provide direct access to the Azure Kinect device.

The following functions are currently supported:

  • Reading colour, infrared and depth stream from mkv
  • Reading and parsing calibration data from mkv
  • Image alignment and point transformation (⚠️not as accurate as the Azure Kinect SDK)

Installation

pip install open-azure-kinect

Usage

In order to load an MKV file, it is necessary to create a new instance of the OpenK4APlayback class.

from openk4a.playback import OpenK4APlayback

azure = OpenK4APlayback("my-file.mkv")
azure.is_looping = True # set loop option if necessary
azure.open()

After that, it is possible to read the available stream information.

for stream in azure.streams:
    print(stream)

And read the actual capture information (image data).

while capture := azure.read():
    # read color frame as numpy array
    color_image = capture.color

Calibration Data

To access the calibration data of the two cameras (Color, Depth), use the parsed information property.

color_calib = azure.color_calibration
depth_calib = azure.depth_calibration

Image and Point Transformations

The class CameraTransform handles the transformation task between the different cameras. ⚠️The methods are not as accurate as the Azure Kinect SDK because some optimisations have not been taken into account yet. Please open a PR if you like to improve it.

Be aware that this part of the framework is still very much under development!

import numpy as np
from openk4a.transform import CameraTransform

estimated_depth_mm = 1500  # adjust this value to improve the calculation accuracy
transform = CameraTransform(azure.color_calibration, azure.depth_calibration, estimated_depth_mm)

# transform points from color to depth image
depth_points = transform.transform_2d_color_to_depth(np.array([[300, 400], [200, 200]]))

# transform color image into depth image
transformed_color = transform.align_image_depth_to_color(color_image)

Development and Examples

To run the examples or develop the library please install the dev-requirements.txt and requirements.txt.

pip install -r dev-requirements.txt
pip install -r requirements.txt

There is already an example script demo.py which provides insights in how to use the library.

About

Copyright (c) 2024 Florian Bruggisser

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 Distribution

open_azure_kinect-0.1.0a6-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file open_azure_kinect-0.1.0a6-py3-none-any.whl.

File metadata

File hashes

Hashes for open_azure_kinect-0.1.0a6-py3-none-any.whl
Algorithm Hash digest
SHA256 151fafa51c8b88fc3669ba238fe5097ba65023c5ac90734df95eccbbad63945a
MD5 19b8a63b908efd71da1d74cfb120d00f
BLAKE2b-256 a2cc576a815538588f3756e3f82b11e80ad009c0b4af4a2c81bea0af6878000b

See more details on using hashes here.

Supported by

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