K4A.Net — Three-in-one managed .NET library to work with Azure Kinect depth sensors (also known as Kinect for Azure, K4A, Kinect v4). Also it can be used to work with Orbbec Femto Bolt and Mega depth sensors via Orbbec SDK K4A Wrapper. It consists of the following "components":
Sensor API
— access to depth camera, RGB camera, accelerometer and gyroscope, plus device-calibration data and synchronization control
K4AdotNet.Sensor
k4a.h
Record API
— data recording from device to MKV-files, and data reading from such files
K4AdotNet.Record
record.h
and playback.h
Body Tracking API
— body tracking of multiple skeletons including eyes, ears and nose
K4AdotNet.BodyTracking
k4abt.h
externals
directory) and NuGet packageK4AdotNet depends on the following native libraries (DLLs) from Azure Kinect Sensor SDK and Azure Kinect Body Tracking SDK:
Library "component" | Depends on | Version in use | Location in repository | Included in NuGet package |
---|---|---|---|---|
Sensor API | k4a.dll , depthengine_2_0.dll (1) |
1.4.1 | externals/k4a/windows-desktop/amd64 |
YES |
Record API | k4arecord.dll |
1.4.1 | externals/k4a/windows-desktop/amd64 |
YES |
Body Tracking API | k4abt.dll (2), dnn_model_2_0_op11.onnx and/or dnn_model_2_0_lite_op11.onnx |
1.1.2 | no(3) |
Notes:
depthengine_2_0.dll
is required only if you are using Transformation
or Device
classes. All other Sensor API (types from K4AdotNet.Sensor
namespace) depends only on k4a.dll
.k4abt.dll
uses ONNX Runtime — onnxruntime.dll
, which in turn depends on the following NVIDIA cuDNN and NVIDIA CUDA 11.2.1 libraries. Also, Visual C++ Redistributable for Visual Studio 2015 is required: vcomp140.dll
.k4abt.dll
(4.4 MB), dnn_model_2_0_op11.onnx
(159 MB) and/or dnn_model_2_0_lite_op11.onnx
(43 MB), cublas64_11.dll
(136 MB), cublasLt64_11.dll
(269 MB), cudart64_110.dll
(0.5 MB), cudnn_cnn_infer64_8.dll
(600 MB), cudnn_ops_infer64_8.dll
(346 MB), cudnn64_8.dll
(0.3 MB), cufft64_10.dll
(345 MB), vcomp140.dll
(0.2 MB). TensorRT
and DirectML
tracking modes.)How to use Body Tracking runtime:
tools
of Body Tracking SDK.Program Files
bool Sdk.IsBodyTrackingRuntimeAvailable(out string message)
method to check if Body Tracking runtime and all required components are available/installedbool Sdk.TryInitializeBodyTrackingRuntime(TrackerProcessingMode mode, out string message)
method on start of your application to initialize Body Tracking runtime (it can take a few seconds)See https://github.com/bibigone/k4a.net/releases
K4AdotNet.sln
in Visual Studio 2022Ctrl+Shift+B
)K4AdotNet.Samples.Console.BodyTrackingSpeed
— sample .NET 7 console application to measure speed of Body Tracking.K4AdotNet.Samples.Console.Recorder
— sample .NET 7 console application to record data from Azure Kinect device to MKV file.K4AdotNet.Samples.Wpf.Viewer
— sample WPF application to demonstrate usage of Sensor API and Record API.K4AdotNet.Samples.Wpf.BodyTracker
— sample WPF application to demonstrate usage of Body Tracking API.K4AdotNet.Samples.Wpf.BackgroundRemover
— sample WPF application which implements the background removal effect for color picture with the help of depth data.This library is compatible with Orbbec Femto Bolt and Mega depth sensors. It is possible due to Orbbec SDK K4A Wrapper that implements the API of original native K4A library via Orbbec SDK.
ORBBECSDK_K4A_WRAPPER
constant must be defined to compile the Orbbec-compatible version of the library. See Product.props
file for details.
Note. There is no full compatibility between Orbbec SDK K4A Wrapper and original K4A library. Major differences between them are described here. But actually there are much more inconsistencies. Check value of the Sdk.IsOrbbecSdkK4AWrapper
property in client code to determine what version of library is in use.