Getting started with Kinect for Windows SDK Programming

Abhijit Jana

February 2013

(For more resources related to this topic, see here.)

System requirements for the Kinect for Windows SDK

While developing applications for any device using an SDK, compatibility plays a pivotal role. It is really important that your development environment must fulfill the following set of requirements before starting to work with the Kinect for Windows SDK.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at
If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.

Supported operating systems

The Kinect for Windows SDK, as its name suggests, runs only on the Windows operating system. The following are the supported operating systems for development:

  • Windows 7

  • Windows Embedded 7

  • Windows 8

The Kinect for Windows sensor will also work on Windows operating systems running in a virtual machine such as Microsoft HyperV, VMWare, and Parallels.

System configuration

The hardware requirements are not as stringent as the software requirements. It can be run on most of the hardware available in the market. The following are the minimum configurations required for development with Kinect for Windows:

  • A 32- (x86) or 64-bit (x64) processor

  • Dual core 2.66 GHz or faster processor

  • Dedicated USB 2.0 bus

  • 2 GB RAM

The Kinect sensor

It goes without saying, you need a Kinect sensor for your development. You can use the Kinect for Windows or the Kinect for Xbox sensor for your development.

Before choosing a sensor for your development, make sure you are clear about the limitations of the Kinect for Xbox sensor over the Kinect for Windows sensor, in terms of features, API supports, and licensing mechanisms.

The Kinect for Windows sensor

By now, you are already familiar with the Kinect for Windows sensor and its different components. The Kinect for Windows sensor comes with an external power supply, which supplies the additional power, and a USB adapter to connect with the system. For the latest updates and availability of the Kinect for Windows sensor, you can refer to

The Kinect for Xbox sensor

If you already have a Kinect sensor with your Xbox gaming console, you may use it for development. Similar to the Kinect for Windows sensor, you will require a separate power supply for the device so that it can power up the motor, camera, IR sensor, and so on.

If you have bought a Kinect sensor with an Xbox as a bundle, you will need to buy the adapter / power supply separately. You can check out the external power supply adapter at If you have bought only the Kinect for Xbox sensor, you will have everything that is required for a connection with a PC and external power cable.

Development tools and software

The following are the software that are required for development with Kinect SDK:

  • Microsoft Visual Studio 2010 Express or higher editions of Visual Studio

  • Microsoft .NET Framework 4.0 or higher

  • Kinect for Windows SDK

Kinect for Windows SDK uses the underlying speech capability of a Windows operating system to interact with the Kinect audio system. This will require Microsoft Speech Platform – Server Runtime, the Microsoft Speech Platform SDK, and a language pack to be installed in the system, and these will be installed along with the Kinect for Windows SDK. The system requirements for SDK may change with upcoming releases. Refer to kinectforwindows/. for the latest system requirements.

Evaluation of the Kinect for Windows SDK


Though the Kinect for Xbox sensor has been in the market for quite some time, Kinect for Windows SDK is still fairly new in the developer paradigm, and it's evolving. The book is written on Kinect for Windows SDK v1.6. The Kinect for Windows SDK was first launched as a Beta 1 version in June 2011, and after a thunderous response from the developer community, the updated version of Kinect for Windows SDK Beta 2 version was launched in November 2011. Initially, both the SDK versions were a non-commercial release and were meant only for hobbyists. The first commercial version of Kinect for Windows SDK (v1.0) was launched in February 2012 along with a separate commercial hardware device. SDK v1.5 was released on May 2012 with bunches of new features, and the current version of Kinect for Windows SDK (v1.6) was launched in October 2012. The hardware hasn't changed since its first release. It was initially limited to only 12 countries across the globe. Now the new Kinect for Windows sensor is available in more than 40 countries. The current version of SDK also has the support of speech recognition for multiple languages.


Downloading the SDK and the Developer Toolkit

The Kinect SDK and the Developer Toolkit are available for free and can be downloaded from

The installer will automatically install the 64- or 32-bit version of SDK depending on your operating system. The Kinect for Windows Developer Toolkit is an additional installer that includes samples, tools, and other development extensions. The following diagram shows these components:


The main reason behind keeping SDK and Developer Toolkit in two different installers is to update the Developer Toolkit independently from the SDK. This will help to keep the toolkit and samples updated and distributed to the community without changing or updating the actual SDK version. The version of Kinect for Windows SDK and that for the Kinect for Windows Developer Toolkit might not be the same.

Installing Kinect for Windows SDK

Before running the installation, make sure of the following:

  • You have uninstalled all the previous versions of Kinect for Windows SDK

  • The Kinect sensor is not plugged into the USB port on the computer

  • There are no Visual Studio instances currently running

Start the installer, which will display the start screen as End User License Agreement. You need to read and accept this agreement to proceed with the installation. The following screenshot shows the license agreement:


Accept the agreement by selecting the checkbox and clicking on the Install option, which will do the rest of the job automatically.

Before the installation, your computer may pop out the User Access Control (UAC) dialog, to get a confirmation from you that you are authorizing the installer to make changes in your computer.

Once the installation is over, you will be notified along with an option for installing the Developer Toolkit, as shown in the next screenshot:

Is it mandatory to uninstall the previous version of SDK before we install the new one?

The upgrade will happen without any hassles if your current version is a non-Beta version. As a standard procedure, it is always recommended to uninstall the older SDK prior to installing the newer one, if your current version is a Beta version.

Installing the Developer Toolkit

If you didn't downloaded the Developer Toolkit installer earlier, you can click on the Download the Developer Toolkit option of the SDK setup wizard (refer to the previous screenshot); this will first download and then install the Developer Toolkit setup. If you have already downloaded the setup, you can close the current window and execute the standalone Toolkit installer. The installation process for Developer Toolkit is similar to the process for the SDK installer.

Components installed by the SDK and the Developer Toolkit

The Kinect for Windows SDK and Kinect for Windows Developer Toolkit install the drivers, assemblies, samples, and the documentation. To check which components are installed, you can navigate to the Install and Uninstall Programs section of Control Panel and search for Kinect. The following screenshot shows the list of components that are installed with the SDK and Toolkit installer:

The default location for the SDK and Toolkit installation is %ProgramFiles%/Microsoft SDKs/Kinect.

Kinect management service

The Kinect for Windows SDK also installs Kinect Management, which is a Windows service that runs in the background while your PC communicates with the device. This service is responsible for the following tasks:

  • Listening to the Kinect device for any status changes

  • Interacting with the COM Server for any native support

  • Managing the Kinect audio components by interacting with Windows audio drivers

You can view this service by launching Services by navigating to Control Panel |Administrative Tools, or by typing Services.msc in the Run command.

Is it necessary to install the Kinect SDK to end users' systems?

The answer is No. When you install the Kinect for Windows SDK, it creates a Redist directory containing an installer that is designed to be deployed with Kinect applications, which install the runtime and drivers. This is the path where you can find the setup file after the SDK is installed:

%ProgramFiles%/\Microsoft SDKs\Kinect\v1.6\Redist\ KinectRuntime-v1.6-Setup.exe

This can be used with your application deployment package, which will install only the runtime and necessary drivers.

Connecting the sensor with the system

Now that we have installed the SDK, we can plug the Kinect device into your PC. The very first time you plug the device into your system, you will notice the LED indicator of the Kinect sensor turning solid red and the system will start installing the drivers automatically.

The default location of the driver is %Program Files%\Microsoft Kinect Drivers\Drivers.

The drivers will be loaded only after the installation of SDK is complete and it's a one-time job. This process also checks for the latest Windows updates on USB Drivers, so it is good to be connected to the Internet if you don't have the latest updates of Windows.

The check marks in the dialog box shown in the next screenshot indicate successful driver software installation:

When the drivers have finished loading and are loaded properly, the LED light on your Kinect sensor will turn solid green. This indicates that the device is functioning properly and can communicate with the PC as well.

Verifying the installed drivers

This is typically a troubleshooting procedure in case you encounter any problems. Also, the verification procedure will help you to understand how the device drivers are installed within your system. In order to verify that the drivers are installed correctly, open Control Panel and select Device Manager; then look for the Kinect for Windows node. You will find the Kinect for Windows Device option listed as shown in the next screenshot:

Not able to view all the device components

At some point of time, it may happen that you are able to view only the Kinect for Windows Device node (refer to the following screenshot). At this point of time, it looks as if the device is ready. However, a careful examination reveals a small hitch. Let's see whether you can figure it out or not! The Kinect device LED is on and Device Manager has also detected the device, which is absolutely fine, but we are still missing something here. The device is connected to the PC using the USB port, and the system prompt shows the device installed successfully—then where is the problem?

The default USB port that is plugged into the system doesn't have the power capabilities required by the camera, sensor, and motor. At this point, if you plug it into an external power supplier and turn the power on, you will find all the driver nodes in Device Manager loaded automatically.

This is one of the most common mistakes made by the developers. While working with Kinect SDK, make sure your Kinect device is connected with the computer using the USB port, and the external power adapter is plugged in and turned on.

The next picture shows the Kinect sensor with USB connector and power adapter, and how they have been used:

With the aid of the external power supply, the system will start searching for Windows updates for the USB components. Once everything is installed properly, the system will prompt you as shown in the next screenshot:

All the check marks in the screenshot indicate that the corresponding components are ready to be used and the same components are also reflected in Device Manager.

The messages prompting for the loading of drivers, and the prompts for the installation displaying during the loading of drivers, may vary depending upon the operating system you are using. You might also not receive any of them if the drivers are being loaded in the background.

Detecting the loaded drivers in Device Manager

Navigate to Control Panel | Device Manager, look for the Kinect for Windows node, and you will find the list of components detected. Refer to the next screenshot:

The Kinect for Windows Audio Array Control option indicates the driver for the Kinect audio system whereas the Kinect for Windows Camera option controls the camera sensor. The Kinect for Windows Security Control option is used to check whether the device being used is a genuine Microsoft Kinect for Windows or not. In addition to appearing under the Kinect for Windows node, the Kinect for Windows USB Audio option should also appear under the Sound, Video and Game Controllers node, as shown in the next screenshot:

Once the Kinect sensor is connected, you can identify the Kinect microphone like any other microphone connected to your PC in the Audio Device Manager section. Look at the next screenshot:


Testing your device

Once the SDK installation is complete, you are ready to start the development. But let's start with a few bits of testing.

Testing Kinect sensors

The Developer Toolkit has a set of sample applications; you can choose any of them to test the device. To quickly check it out, you can run the Kinect Explorer application from the Developer Toolkit. The Kinect Explorer demonstrates the basic features of the Kinect for Windows SDK, which retrieves color, depth, and skeleton data and displays them on the UI. The next screenshot shows the UI reference of the application:

If you are also able to view a similar-looking output, where you can see the Kinect sensor returning the depth, color, and skeleton data, you can be sure that your device has been installed properly.

Testing the Kinect microphone array

You can use Kinect as a microphone. Navigate to the Sound section in Control Panel and select the Recording tab to see Kinect's Microphone Array. This is shown in the following screenshot. You can also see the bar along with the microphone array, which indicates the level of sound. You can do everything that a PC's audio tool is capable of doing.

To ensure that the Kinect microphone array is capturing the sound clearly and passing it to your system, you can use the Listen To this device option. To enable this, right-click on Microphone Array and select Properties. This is shown in the next screenshot:

This will launch the Microphone Array Property window. Move to the Listen tab, select the Listen to this device checkbox, and click on Apply. This is shown in the next screenshot:

Now, if your system's speaker is turned on and you speak in front of the Kinect device, you should get to hear the same voice via your system's speaker. This ensures that your Kinect audio device is also configured properly.

Looking inside the Kinect SDK

The Kinect SDK provides both managed and unmanaged libraries. If you are developing an application using either C# or VB.NET, you can directly invoke the .NET Kinect Runtime APIs; and for C++ applications, you have to interact with the Native Kinect Runtime APIs. Both the types of APIs can talk to the Kinect drivers that are installed as a part of SDK installation.

The unmanaged and managed libraries provide access to the same set of Kinect sensor features.

For managed code, the Kinect for Windows SDK provides Dynamic Link Library (DLL) as an assembly (Microsoft.Kinect.dll), which can be added to any application that wants to use the Kinect device. You can find this assembly in the SDK installation directory, as shown in the next screenshot:

The Kinect driver can control the camera, depth sensor, audio microphone array, and the motor. Data passes between the sensor and the application in the form of data streams of the following types:

  • Color data stream

  • Depth data stream

  • Audio data stream

The unmanaged and managed libraries provide access to the same set of Kinect sensor features.

The next diagram illustrates the overall layered components for the Kinect SDK, and it shows how an application interacts with different layers of components:

Features of the Kinect for Windows SDK

Well, as of now we have discussed the components of the Kinect SDK, system requirements, installation of SDK, and setting up of devices. Now it's time to have a quick look at the top-level features of Kinect for Windows SDK.

The Kinect SDK provides a library to directly interact with the camera sensors, the microphone array, and the motor. We can even extend an application for gesture recognition using our body motion, and also enable an application with the capability of speech recognition. The following is the list of operations that you can perform with Kinect SDK.

  • Capturing and processing the color image data stream

  • Processing the depth image data stream

  • Capturing the infrared stream

  • Tracking human skeleton and joint movements

  • Human gesture recognition

  • Capturing the audio stream

  • Enabling speech recognition

  • Adjusting the Kinect sensor angle

  • Getting data from the accelerometer

  • Controlling the infrared emitter

Capturing the color image data stream

The color camera returns 32-bit RGB images at a resolution ranging from 640 x 480 pixels to 1280 x 960 pixels. The Kinect for Windows sensor supports up to 30 FPS in the case of a 640 x 480 resolution, and 10 FPS for a 1280 x 960 resolution. The SDK also supports retrieving of YUV images with a resolution of 640 x 480 at 15 FPS.

Using the SDK, you can capture the live image data stream at different resolutions. While we are referring to color data as an image stream, technically it's like a succession of color image frames sent by the sensor. The SDK is also capable of sending an image frame on demand from the sensor.

Processing the depth image data stream

The Kinect sensor returns 16-bit raw depth data. Each of the pixels within the data represents the distance between the object and the sensor. Kinect SDK APIs support depth data streams at resolutions of 640 x 480, 320 x 240, and 80 x 60 pixels.

Near Mode

The Near Mode feature helps us track a human body within a very close range (of approximately 40 centimeters). We can control the mode of sensors using our application; however, the core part of this feature is built in the firmware of the Kinect sensor.

This feature is limited to the Kinect for Windows sensor only. If you are using the Xbox sensor, you won't be able to work with Near Mode.

Capturing the infrared stream

You can also capture images in low light conditions, by reading the infrared stream from the Kinect sensor. The Kinect sensor returns 16 bits per pixel infrared data with a resolution of 640 x 480 as an image format, and it supports up to 30 FPS. The following is an image captured from an infrared stream:

You cannot read color and infrared streams simultaneously, but you can read depth and infrared data simultaneously. The reason behind this is that an infrared stream is captured as a part of a color image format.

Tracking human skeleton and joint movements

One of the most interesting parts of the Kinect SDK is its support for tracking the human skeleton. You can detect the movement of the human skeleton standing in front of a Kinect device. Kinect for Windows can track up to 20 joints in a single skeleton. It can track up to six skeletons, which means it can detect up to six people standing in front of a sensor, but it can return the details of the full skeleton (joint positions) for only two of the tracked skeletons.

The SDK also supports tracking the skeleton of a human body that is seated. The Kinect device can track your joints even if you are seated, but up to 10 joint points only (upper body part).

The next image shows the tracked skeleton of a standing person, which is based on depth data:

Capturing the audio stream

Kinect has four microphones in a linear configuration. The SDK provides high-quality audio processing capabilities by using its own internal audio processing pipeline. The SDK allows you not only to capture raw audio data, but also high-quality audio processing by enabling the noise suppression and echo cancellation features. You can also control the direction of the beam of the microphone array with the help of the SDK.

Speech recognition

You can take advantage of the Kinect microphone array and Windows Speech Recognition APIs to recognize your voice and develop relevant applications. You can build your own vocabulary and pass it to the speech engine, and design your own set of voice commands to control the application. If a user says something with some gestures, say while moving a hand as shown in the following picture, an application can be developed to perform some work to be done depending on the user's gestures and speech.

Human gesture recognition

A gesture is nothing but an action intended to communicate feelings or intentions to the device. Gesture recognition has been a prime research area for a long time. However, in the last decade, a phenomenal amount of time, effort, and resources have been devoted to this field in the wake of the development of devices. Gesture recognition allows people to interface with a device and interact naturally with body motion, as with the person in the following picture, without any device attached to the human body.

In the Kinect for Windows SDK, there is no direct support for an API to recognize and deal with human gestures; however, by using skeleton tracking and depth data processing, you can build your own gesture API, which can interact with your application.

Tilting the Kinect sensor

The SDK provides direct access to controlling the motor of the sensor. By changing the elevation angles of the sensors, you can set the viewing angle for the Kinect sensor as per your needs. The maximum and minimum value of elevation angle is limited to +27 degrees and -27 degrees, in SDK. If you try to change the sensor angle more or less than these specified ranges, your application will throw an invalid operation exception.

The tilting is allowed only for the vertical direction. There is no horizontal tilting with Kinect sensors.

Getting data from the accelerometer of the sensor

Kinect treats the elevation angle as being relative to the gravity and not its base, as it uses its accelerometers to control the rotation. The Kinect SDK exposes the APIs to read the accelerometer data directly from the sensor. You can detect the sensor orientation by reading the data from accelerometer of the sensor.

Controlling the infrared emitter

Controlling the infrared emitter is a very small but very useful feature of the Kinect SDK, where you can forcefully turn the infrared emitter off. This is required while dealing with the data from multiple sensors, and when you want to capture data from specific sensors by turning off the IR emitters of other sensors.

This feature is limited only to the Kinect for Windows sensor. If you are using the Xbox sensor, you will get InvalidOperationException with the The feature is not supported by this version of the hardware message.

The Kinect for Windows Developer Toolkit

Kinect for Windows Developer Toolkit is an additional set of components that helps you to build sophisticated applications easily by providing access to more tools and APIs. This toolkit has a number of samples, documentation for SDK API libraries, the Kinect Studio tool (a tool that can help you record and play Kinect and data during debugging), as well as the Face Tracking SDK.

After the installation of Developer Toolkit, you will get a standalone executable within the toolkit that is installed in the directory. Run the application; it will display the screen as shown in the following screenshot. You can navigate through it for resources and samples.

The Face Tracking SDK

The Face Tracking SDK is a part of the Kinect for Windows Developer Toolkit. It contains a few sets of APIs that you can use to track a human face, by taking advantages of Kinect SDK APIs. The SDK detects and tracks the positions and orientations of faces, and it can also animate eye brow positions and the shape of mouth in real time. The Face Tracking SDK can be used in several places, such as recognizing facial expressions, NUI interaction with the face, and tasks that are related to the face.

The next image shows a basic face tracking instance using the Kinect for Windows and Face Tracking SDKs.

Kinect Studio

Kinect Studio can record and playback the sensor's data stream. It's a very handy and useful tool for developers during testing and while dealing with debugging of Kinect applications. The Kinect data stream can be recorded and saved in a .xed file format for future use. What does that mean? How does that help? Well, let's say you are developing an application based on gestures, and you need to perform that gesture every time to test or debug your application; in this case, using the Kinect Studio you can record your action once and just play the recording again and again.

The permission level for both Kinect Studio and the application that is used by Kinect Studio, has to be the same.

The next screenshot shows a quick view of Kinect Studio, which is displaying the color view, depth view, and 3D view of the data captured by Kinect:

I have covered more on the Face Tracking SDK and Kinect Studio in the latter part of this book.

Making your development setup ready

While the device and driver setup look good, you need to ensure your development environment is ready as well.

The basic software you require for setting up the development environment are Visual Studio 2010 Express Edition or any higher edition along with .NET 4.0 Framework, which we have already discussed as a part of system requirement.

If you are already familiar with development using Visual Studio, the basic steps for implementing an application using a Kinect device should be straightforward. You simply have to perform the following operations:

  1. Launch a new instance of Visual Studio.

  2. Create a new project.

  3. Refer to the Microsoft.Kinect.dll file.

  4. Declare the appropriate namespaces for the added assembly.

  5. Start using the Kinect SDK API library.

The Coding4Fun Kinect Toolkit

The Coding4Fun Kinect Toolkit provides several necessary extension methods to make developing of application using the Kinect for Windows SDK faster and easier. You can download the Coding4Fun Kinect Toolkit from http://c4fkinect.

The Coding4Fun Kinect Toolkit is also available as a NuGet package. You can install it using the NuGet Package Manager console within Visual Studio.


In this article we have covered the prerequisites of an SDK installation, that is, the hardware and software requirements for the installation. A brief step-by-step guide for the installation, loading of drivers, and for setting up the development environment is also discussed. We have seen a quick overview of the Kinect SDK features and also the new Kinect SDK Developer Toolkit. We have also seen how the SDK provides an opportunity to developers to build applications using different languages such as C#, VB.NET, or C++.

Resources for Article :

Further resources on this subject:

You've been reading an excerpt of:

Kinect for Windows SDK Programming Guide

Explore Title