Awesome Open Source
Awesome Open Source

K4A.Net (K4AdotNet)

K4A.NetThree-in-one managed .NET library to work with Azure Kinect devices (also known as Kinect for Azure, K4A, Kinect v4). It consists of the following "components":

  1. Sensor API — access to depth camera, RGB camera, accelerometer and gyroscope, plus device-calibration data and synchronization control
    • Corresponding namespace: K4AdotNet.Sensor
    • Corresponding native API: k4a.h
  2. Record API — data recording from device to MKV-files, and data reading from such files
    • Corresponding namespace: K4AdotNet.Record
    • Corresponding native API: record.h and playback.h
  3. Body Tracking API — body tracking of multiple skeletons including eyes, ears and nose
    • Corresponding namespace: K4AdotNet.BodyTracking
    • Corresponding native API: k4abt.h

Key features


K4AdotNet 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.0 no(3)


  • (1) 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.
  • (2) k4abt.dll uses ONNX Runtimeonnxruntime.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.
  • (3) The full list of libraries and data files required for Body Tracking:
    k4abt.dll (4.3 MB),
    dnn_model_2_0_op11.onnx (159 MB) and/or dnn_model_2_0_lite_op11.onnx (43 MB),
    cublas64_11.dll (108 MB),
    cublasLt64_11.dll (204 MB),
    cudart64_110.dll (0.4 MB),
    cudnn_cnn_infer64_8.dll (673 MB),
    cudnn_ops_infer64_8.dll (308 MB),
    cudnn64_8.dll (0.3 MB),
    cufft64_10.dll (224 MB),
    vcomp140.dll (0.2 MB).
    (Plus additional libraries for TensorRT and DirectML tracking modes.)
    It is mostly unpractical to have such bulky files in repositories. For this reason they are not included to the repository. Also, they are not included to NuGet package.

How to use Body Tracking runtime:

  • The easiest way to use Body Tracking is to ask user to install Body Tracking SDK by him/herself:
  • But you can also put all required libraries and data files to the output directory of your project (on post-build step, for example). All required libraries and data files can be found in directory tools of Body Tracking SDK.
  • K4AdotNet is trying to find Body Tracking runtime in the following locations:
    • directory with executable file
    • directory with K4AdotNet assembly
    • installation directory of Body Tracking SDK under Program Files
  • Use bool Sdk.IsBodyTrackingRuntimeAvailable(out string message) method to check if Body Tracking runtime and all required components are available/installed
  • Also, you can optionally call bool Sdk.TryInitializeBodyTrackingRuntime(TrackerProcessingMode mode, out string message) method on start of your application to initialize Body Tracking runtime (it can take a few seconds)



How to build

  • Open K4AdotNet.sln in Visual Studio 2019
  • Build solution (Ctrl+Shift+B)
  • After that you can run and explore samples:
    • K4AdotNet.Samples.Core.BodyTrackingSpeed — sample .NET Core 3.1 console application to measure speed of Body Tracking.
    • K4AdotNet.Samples.Core.Recorder — sample .NET Core 3.1 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 implementing the background removal effect for color picture with the help of depth data.
  • Instruction on building Unity sample can be found here.
Alternatives To
Select To Compare

Alternative Project Comparisons
Related Awesome Lists
Top Programming Languages
Top Projects

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
C Sharp (166,272
Sdk (32,751
Azure (17,835
Sensor (15,806
Kinect (2,000