65.9K
CodeProject is changing. Read more.
Home

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

emptyStarIconemptyStarIconemptyStarIconemptyStarIconemptyStarIcon

0/5 (0 vote)

Feb 13, 2013

CPOL

3 min read

viewsIcon

12101

downloadIcon

316

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