Page 1 of 3
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
- Getting started with Microsoft Kinect SDK (this article)
- Player index
- Depth and Video space
- 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.
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:
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:
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.
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.
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.
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.
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:
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.