File Exchange

image thumbnail


version 1.2 (881 KB) by Juan R. Terven
Matlab Toolbox for Azure Kinect


Updated 03 Nov 2020

From GitHub

View Version History

View license on GitHub

Matlab interface for the Azure Kinect

- Azure Kinect SDK.
- C++ compiler
- MATLAB 2015b or newer for pointCloudDemo2, which uses MATLAB's built-in pointCloud object

1. Install the Azure Kinect SDK as described in For Windows, download the .exe where it says Microsoft installer and follow the steps. For Ubuntu use the sudo apt install commands shown on the same page.
2. For Body tracking functionality (optional) you need an NVIDIA GPU and install CUDA. Download from
3. For Body tracking, install the Azure Kinect Body Tracking SDK. For Windows, download the msi installer from
For Ubuntu run the sudo apt install command provided on the webpage.
4. Before compiling the code for Matlab, make sure the Kinect works correctly using the viewers provided by Microsoft, e.g. C:\Program Files\Azure Kinect SDK v1.4.1\tools\k4aviewer.exe and *C:\Program Files\Azure Kinect Body Tracking SDK\tools\k4abt_simple_3d_viewer.exe*.
In Linux just type k4aviewer or k4abt_simple_3d_viewer (for body tracking) in the terminal.
5. Once the Kinect is correctly installed, close the viewer, and open Matlab.
6. In Matlab, set the compiler for C++ as shown in
5. Open the compile_for_windows.m or compile_for_linux.m, set the corresponding paths, and run. If the compilation was successful, add the dlls path to the Windows pat
6. (Windows only) Add to the windows path environmental variable the bin directory containing the k4a.dll and optionally k4abt.dll (if compiling the body tracking SDK).
For example add C:\Program Files\Azure Kinect SDK v1.4.1\tools to the path environmental variable. Follow the instructions described in

1) videoDemo.m: displays depth, color, infrared video, and sensor data.
2) calibrationDemo.m: obtain depth camera intrinsic parameters and color camera parameters.
4) bodyTrackingDemo.m: displays depth and color and the skeleton on both images
5) pointCloudDemo.m: displays depth and a colored point cloud on a scatter3
6) pointCloudDemo2.m displays the depth and a colored point cloud using MATLAB's built-in pointCloud object and pcshow.

Cite As

Juan R. Terven (2021). KinZ-Matlab (, GitHub. Retrieved .

Comments and Ratings (6)

jianfu zhao

Why can't I use body tracking?

Yuxiang Hua

oh,God!I met the same question as Yuxiang Hua met.It troubles me a lot.I need to close the matlab to clear the RAM after I display the pointcloud sometimes.It seems that the data of the pointcloud is stored in the RAM continuously.I'd appreciate if you can solve the problem as soon as possible .thank you very much!

Yuxiang Hua

We just found that pc = kz.getpointcloud('output','pointCloud','color','true'); resulted in the memory increasment. Really appreciate your response. Thanks.

Yuxiang Hua

When I run the demos for Azure Kinect, the memory is increasing continiously. But the phenomenon does not appear in the demos for Kinect V2. How can I avoid the memory accumulation?Thanks.

James morgenstern

James morgenstern

additional question: the Kinect SDK is installed at
C:\Program Files\Azure Kinect SDK v1.4.1\sdk\include\k4a
C:\Program Files\Azure Kinect SDK v1.4.1\sdk\windows-desktop\x86\release\lib

so do i change your file IncludePath and LibPath for these ?


MATLAB Release Compatibility
Created with R2018a
Compatible with R2015b to R2020b
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!