Click here to Skip to main content
Click here to Skip to main content

Migrating applications developed in Kinect for Windows Beta 2 to v1.0 using C#

, 13 Feb 2013
Rate this:
Please Sign up or sign in to vote.
Migrating applications developed in Kinect for Windows Beta 2 to v1.0 using C#

Introduction

Kinect has changed the way people play games and experience entertainment. Now, Kinect for Windows offers the potential to transform how people interact with computers and Windows-embedded devices in multiple industries, including education, healthcare, retail, transportation, and beyond.

The Kinect for Windows sensor and software development kit (SDK) open up the limitless possibilities offered by Kinect technology. Together, they offer a superior development platform for Windows and a high quality end-user experience.

Note: More information on basics of Kinect for Windows is available under:

Following are the hardware and software requirements to get started developing Kinect for Windows applications.

Hardware requirements

  • Computer with a dual core, 2.66-GHz or faster processor
  • Windows 7-compatible graphics card that supports Microsoft DirectX 9.0c capabilites 2GB of RAM
  • Kinect for Windows device

Software Requirements

  • Microsoft Visual Studio 2010 Express or other Visual Studio edition
  • Microsoft .Net framework 4.0
  • Kinect for Windows SDK

Objective

There are various applications developed in Kinect for Windows Beta 2 so the objective of our little exercise is to provide a clear explanation on how to migrate applications to v1.0 . There have been a number of significant changes and improvements in the APIs since Beta2. This set of documents attempts to detail the changes to facilitate code migration from beta 2 to v1.

For the complete list of API change from Beta 2 to v1.0 please refer http://robrelyea.wordpress.com/2012/02/01/k4w-code-migration-from-beta2-to-v1-0-managed/

http://robrelyea.wordpress.com/2012/02/01/k4w-details-of-api-changes-from-beta2-to-v1-managed/

So let’s get started ...

I have taken an application that was developed in Beta2 by Ray Chambers and will try to migrate it to V1.0. The source code can be downloaded from this document.

Open the solution file in VS 2010. When you try to build the solution you will get the following errors as shown below

Figure 1: Build errors

The above errors have occurred due to the DLL change of Microsoft.Research.Kinect.dll(Beta2) to Microsoft.Kinect.dll(V1.0).

So let us first solve this problem. Remove the Microsoft.Research.Kinect.dll and add Microsoft.Kinect.Migration.dll. You need to explicitly download this DLL from Microsoft site. Ensure all projects, including binary dependencies, are migrated. Try building the solution again after adding the reference to the new DLL. Now you will notice more errors don’t worry we are in the right track.

Figure 2: Build Error after DLL change

After changing all the "usings" of the old namespace to "using   Microsoft.Kinect;", most of the errors/warnings will point you to renames of   types/members

In MainWindow.xaml.cs change the line (Runtime runtime = Runtime.Kinects[0]) to (Skeleton[] skeletons; KinectSensor runtime = null;)

Comment the VideoFrameReady and SkeletonFrameReady from runtime

 

Figure 3: Runtime Comment

As the runtime API has been completely changed we need to change the way it is initialized in MainWindow_Loaded function.

Old implementation

 

Figure 4: Runtime code initialisation(old)

New implementation

 

Figure 5: Runtime code initialisation(new)

In the new Kinect for Windows SDK version, Runtime now has 3 general events (ColorFrameReady,SkeletonFrameReady and AllFramesReady)

Add the runtime_ColorFrameReady eventhandler:

Figure 6: New ColorFrameReady event

Now moving to SkeletonFrameReady:

Older implementation

Figure 7: SkeletonFrameReady(Old)

New implementation

Figure 8:Skeleton Frame(New)

In the older Kinect for Windows version vector was used to denote the position in the new SDK it has been changed to SKeletonPoint.

Moving to SetEllipsePosition error:

Old implementation 

Figure 9: Method Change(Old) 

New implementation 

Figure 10: Method Change(New)

runtime.NuiCamera.ElevationAngle has been changed to runtime.ElevationAngle

and runtime.Unitialize() has been renamed to runtime.Stop().

After making these changes try building the application again. If every changes has been done correctly then you will see "Build Succeded".

On launching the application you will receive a message pop up saying you have successfully migrated the application.

Figure 11: Success PopUp

Now remove the Microsoft.Kinect.Migration reference and add the Microsoft.Kinect.dll from the Kinect SDK installed location. Now the application is ready to use

Figure 12: Running Application

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Sajesh.Nambiar
Software Developer (Senior) Siemens Technology and Services
India India
No Biography provided

Comments and Discussions

 
Questionabout kinect button event PinmemberMember 105741425-Feb-14 6:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140709.1 | Last Updated 13 Feb 2013
Article Copyright 2013 by Sajesh.Nambiar
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid