Getting started with Microsoft Kinect SDK
Written by Mike James   
Friday, 17 June 2011
Article Index
Getting started with Microsoft Kinect SDK
Hello Kinect in Windows Forms
Working in WPF

The eagerly awaited Microsoft SDK for Kinect has been released - so we can now get on and develop all those innovative projects that it seems ideal for. In this article we look at how easy it is to start writing Kinect software using C#.

UPDATE: A new version of the entire series for SDK 1.0 is being prepared and should be published next week.

The first part is Getting started with Windows Kinect SDK 1.0

If you don't want to miss it subscribe to the RSS feed, follow us on Google+, Twitter, Linkedin or Facebook or sign up for our weekly newsletter.

Other Articles in this Series

  1. Getting started with Microsoft Kinect SDK (this article)
  2. Depth
  3. Player index
  4. Depth and Video space
  5. Skeletons
  6. The Full Skeleton


The Microsoft official SDK for Kinect (updated to Beta 2) is easy to use. Basically you download it, plug the Kinect into a free USB socket and start programming. You can create applications in C#, VB or any .NET language including C++. Its only disadvantage is that it has a non-commercial licence which means you cannot use it to make any profit or even use it at all within a profit making organization. If all you want to do is explore the Kinect or have some fun then this is no big problem.

You also need to be running Windows 7 which is perhaps a bigger restriction.

As well as being easy to use the new SDK is also significantly more powerful than what you can find as open source - it has an improved body tracker and it supports the Kinect's sound hardware.

In this article we look at how easy it is to start writing software using C#.

First you need to prepare the hardware and this isn't without its difficulties.

The hardware

If you look at the plug on the end of the cable that comes out of the Kinect you will realise that what you have looks like a USB connector but not quite. The connector used is a proprietary connector designed to allow the Kinect to be plugged into the new black XBOX 360 without the use of an external power supply. Older XBOXes don't have the special connector and they come with an external power supply which has an adaptor to convert the Kinect plug into a standard USB connector and power supply connector.

If you have bought a Kinect with a recent XBox as a bundle then you will need to buy the adaptor/power supply. At the moment these are only available from the Microsoft store. If you go to:

http://store.microsoft.com/home.aspx

then you should be able to select a local version of the store from the list if you are not in the US. To find the appropriate power supply search on Kinect Sensor Power Supply. The unit costs less than $20 but be warned they seem to go out of stock very quickly. At the moment there are no 3rd party adaptors but this is likely to change.

If you can't wait for the unit to be back in stock or if you want to make something custom then it is quite easy to work out the pin connections:

Pin Description
1 +12V
2 Data -
3 Data +
4 Ground
5 +5V
6 +12V
7 Gnd
8 Gnd
9 N/C

 

If you look at the end of the connector pin 1 is next to the beveled corner with pints 2 to 5 next to it and pin 6 below it.  You can, of course, do the job by cutting the cable and wiring a 12V supply and a standard USB connector.

The software

Once you have solved the problem of plugging the Kinect in your next step is to download the software. This is trivial. Go to Download the SDK and either select the 64-bit or 32-bit version. If in doubt download both as the installer won't let you install the wrong version. Next you need a copy of Visual Studio. If you don't have a full copy of Visual Studio then simply download the Express version and install it: http://www.microsoft.com/express.

Once you have installed the SDK you can plug in your Kinect and you should see the drivers automatically install. To check that they have been installed you should be able to see three Kinect devices in the Device Manager.

 

devicemanager

 

There is also a Kinect audio device listed under audio.

To check that they have worked try running the "Sample Skeletal Viewer" which shows the depth map, video and the detected skeleton of anyone in the view. If you find it's not working you are probably too close.  There is also a complete demo of a game - The Shape Game - that involves tracking two players at the same time. The source  code for both samples is included with the SDK and once you get beyond the beginnings you can use them as the basis for your own applications.

If you find that the device drivers aren't installed you need to make sure that you install the SDK and then plugged the Kinect in. If not the simple solution is to disconnect it and then plug it back in when it should be recognized and the drivers installed.

 

Hello Kinect

Getting started with Kinect is fairly easy but there are some small things that might cause problems.

Start a new project - it doesn't matter really if it is a Windows Forms or WPF project but to make things easier let's start with a Windows Forms. Information about how to make a WPF version work is included as we go on.

Note: if you have used an earlier Beta to create a project make sure you remove the reference to the old DLL.

Next you need to include a reference to Microsoft.Research.Kinect.dll. Right click on the project in the project window and select Add Reference. Finding the Dll in the .NET tab can be difficult so click on the Component Name tab to put them into alphabetical order and scroll down to the Microsoft section.

 

reference2

 

The project has to target the x86 platform but in most cases this is the default so you shouldn't have to adjust anything.

To avoid having to type fully qualified names add:

using Microsoft.Research.Kinect.Nui;
using Microsoft.Research.Kinect.Audio;

to the start of the code. You only need the one ending in Audio if you are going to use the audio features of the Kinect.


<ASIN:B002BSA298@COM>

<ASIN:B0036DDW2G@UK>

<ASIN:B0036DDW2G@FR>

<ASIN:B002BSA298@CA>

<ASIN:B003H4QT7Y@DE>

<ASIN:B00499DBCW@IT>

<ASIN:1849690669>



Last Updated ( Monday, 06 February 2012 )