First look: Kinect for Windows v2 Developer Preview SDK

Longtime readers know that I have great enthusiasm for the Kinect sensor as a revolutionary NUI technology. Now I can report that I was accepted to the Developer Preview program, and my new Kinect for Windows sensor arrived today.

The packaging goes out of its way to make you feel special: when the box opens, the first thing you see is a panel that reads “Developer Preview” under the K4W logo. Beneath that is a panel of K4W stickers.

Shipping box for the Kinect for Windows v2 sensor. Photo: Jim Galasyn Shipping box for the Kinect for Windows v2 sensor, showing a collection of K4W decals. Photo: Jim Galasyn Shipping box for the Kinect for Windows v2 sensor, showing the top of the sensor. Photo: Jim Galasyn

Unpacking the Kinect for Windows v2 sensor.

The sensor itself comes with a couple of snazzy decals.

The Kinect for Windows v2 sensor, with snazzy decals. Photo: Jim Galasyn

The Kinect for Windows v2 sensor, with snazzy decals.

Also, the Developer Preview SDK shipped last week, so I took the whole package for a spin.

There are five sample apps with native (C++/Direct2D) and managed (C#/XAML) solutions:

  • BodyBasics-WPF.exe / BodyBasics-D2D.exe
  • ColorBasics-WPF.exe / ColorBasics-D2D.exe
  • CoordinateMappingBasics-WPF.exe / CoordinateMappingBasics-D2D.exe
  • DepthBasics-WPF.exe / DepthBasics-D2D.exe
  • InfraredBasics-WPF.exe / InfraredBasics-D2D.exe

Unfortunately, we don’t get any Windows Store app demos – all of the included demos run on the desktop only.

After hooking up everything, including the charmingly prototypical router box, I ran the BodyBasics demo. And nothing happened. Hmm.

The prototype router box that supplies power and connects the Kinect for Windows v2 sensor to the computer through USB3.0. Photo: Jim Galasyn The prototype router box that supplies power and connects the Kinect for Windows v2 sensor to the computer through USB3.0. The very bright LEDs indicate that the sensor is powered and connected. Photo: Jim Galasyn

The router box that supplies power and connects the sensor to the computer through USB3.0.

I checked the cables and scrutinized the very bright LEDs (blue means the sensor is connected to computer, apparently). Installed the drivers on a different computer, got the same result.

So I consulted the online docs and found out that the KinectService needs to be running. This lives in the C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Kinect for Windows SDK v2.0 folder. D’oh.

With that little bump overcome, the demo apps run fine.

Screenshot of the BodyBasics-WPF demo application in the Kinect for Windows v2 SDK. Photo: Jim Galasyn

Screenshot of the BodyBasics-WPF demo application in the Kinect for Windows v2 SDK.

Screenshot of the ColorBasics-WPF demo application in the Kinect for Windows v2 SDK. Photo: Jim Galasyn

Screenshot of the ColorBasics-WPF demo application in the Kinect for Windows v2 SDK.

Screenshot of the CoordinateMappingBasics-WPF demo application in the Kinect for Windows v2 SDK. Photo: Jim Galasyn

Screenshot of the CoordinateMappingBasics-WPF demo application in the Kinect for Windows v2 SDK.

Screenshot of the DepthBasics-WPF demo application in the Kinect for Windows v2 SDK. Photo: Jim Galasyn

Screenshot of the DepthBasics-WPF demo application in the Kinect for Windows v2 SDK.

Screenshot of the InfraredBasics-WPF demo application in the Kinect for Windows v2 SDK. Photo: Jim Galasyn

Selfie taken with the InfraredBasics-WPF demo application in the Kinect for Windows v2 SDK.

The inside of the Kinect for Windows v2 shipping box, as seen by the Kinect sensor's infrared camera. Photo: Jim Galasyn

The inside of the Kinect for Windows v2 shipping box, as seen by the Kinect sensor's infrared camera.

In Visual Studio 2013, all of the sample code builds without a hitch. The API seems well designed. For example, here’s how to get the body models in C#:

Initialize body models

  1. // for Alpha, one sensor is supported
  2. this.kinectSensor = KinectSensor.Default;
  3.  
  4. if (this.kinectSensor != null)
  5. {
  6.     // get the coordinate mapper
  7.     this.coordinateMapper = this.kinectSensor.CoordinateMapper;
  8.  
  9.     // open the sensor
  10.     this.kinectSensor.Open();
  11.  
  12.     // get the depth (display) extents
  13.     FrameDescription frameDescription = this.kinectSensor.DepthFrameSource.FrameDescription;
  14.     this.displayWidth = frameDescription.Width;
  15.     this.displayHeight = frameDescription.Width;
  16.  
  17.     this.bodies = new Body[this.kinectSensor.BodyFrameSource.BodyCount];
  18.  
  19.     // open the reader for the body frames
  20.     this.reader = this.kinectSensor.BodyFrameSource.OpenReader();
  21.  
  22.     // set the status text
  23.     this.StatusText = Properties.Resources.InitializingStatusTextFormat;
  24. }
  25. else
  26. {
  27.     // on failure, set the status text
  28.     this.StatusText = Properties.Resources.NoSensorStatusText;
  29. }

Easy peasy. The Microsoft.Kinect namespace has everything you need to interact with the sensor at a high level of abstraction. The classes in the Microsoft.Kinect.dll assembly, extracted by using Ildasm, are appended below.

With this preview of the new SDK, I’m more convinced than ever that Kinect is going to revolutionize NUI. I hope that someday soon this hardware will be miniaturized and built into every laptop and slate.

Classes in the Developer Preview version of Microsoft.Kinect.dll.

//  Microsoft (R) .NET Framework IL Disassembler.  Version 4.0.30319.33440
//  Copyright (c) Microsoft Corporation.  All rights reserved.
//  warning : THIS IS A PARTIAL DISASSEMBLY, NOT SUITABLE FOR RE-ASSEMBLING

KinectExceptionHelper          
CameraSpacePoint               
ColorSpacePoint                
DepthSpacePoint                
Vector4                        
Joint                          
JointOrientation               
BaseBodyDataCollection`2       
ExpressionDetectionResultCollection 
JointCollection                
JointOrientationCollection     
ActivityDetectionResultCollection 
AppearanceDetectionResultCollection 
FrameDescription                
Body                             
ColorCameraSettings              
IsAvailableChangedEventArgs     
FrameCapturedEventArgs          
CoordinateMappingChangedEventArgs  
CoordinateMapper                
CoordinateMapper_CoordinateMappingChanged_EventHandler  
AudioSource                     
BodyFrame                       
BodyFrameReference              
BodyFrameArrivedEventArgs       
BodyFrameReader                 
BodyFrameReader_PropertyChanged_EventHandler  
BodyFrameReader_FrameArrived_EventHandler  
BodyFrameSource                 
BodyFrameSource_FrameCaptured_EventHandler  
BodyIndexFrame                  
BodyIndexFrameReference         
BodyIndexFrameArrivedEventArgs  
BodyIndexFrameReader            
BodyIndexFrameReader_PropertyChanged_EventHandler  
BodyIndexFrameReader_FrameArrived_EventHandler  
BodyIndexFrameSource            
BodyIndexFrameSource_FrameCaptured_EventHandler  
ColorFrame                      
ColorFrameReference             
ColorFrameArrivedEventArgs      
ColorFrameReader                
ColorFrameReader_PropertyChanged_EventHandler  
ColorFrameReader_FrameArrived_EventHandler  
ColorFrameSource                
ColorFrameSource_FrameCaptured_EventHandler  
DepthFrame                      
DepthFrameReference             
DepthFrameArrivedEventArgs      
DepthFrameReader                
DepthFrameReader_PropertyChanged_EventHandler  
DepthFrameReader_FrameArrived_EventHandler  
DepthFrameSource                
DepthFrameSource_FrameCaptured_EventHandler  
InfraredFrame                   
InfraredFrameReference          
InfraredFrameArrivedEventArgs   
InfraredFrameReader             
InfraredFrameReader_PropertyChanged_EventHandler  
InfraredFrameReader_FrameArrived_EventHandler  
InfraredFrameSource             
InfraredFrameSource_FrameCaptured_EventHandler  
LongExposureInfraredFrame       
LongExposureInfraredFrameReference  
LongExposureInfraredFrameArrivedEventArgs  
LongExposureInfraredFrameReader  
LongExposureInfraredFrameReader_PropertyChanged_EventHandler  
LongExposureInfraredFrameReader_FrameArrived_EventHandler  
LongExposureInfraredFrameSource  
LongExposureInfraredFrameSource_FrameCaptured_EventHandler  
MultiSourceFrameArrivedEventArgs  
MultiSourceFrameReader          
MultiSourceFrameReader_PropertyChanged_EventHandler  
MultiSourceFrameReader_MultiSourceFrameArrived_EventHandler  
KinectSensor                    
KinectSensor_PropertyChanged_EventHandler  
KinectSensor_IsAvailableChanged_EventHandler  
MultiSourceFrame                
MultiSourceFrameReference       
_KinectStatus                  
_FrameSourceTypes              
_ColorImageFormat              
_HandState                     
_DetectionResult               
_TrackingConfidence            
_TrackingState                 
_FrameCapturedStatus           
Activity                        
Appearance                      
AudioBeamMode                   
ColorImageFormat                
DetectionResult                 
Expression                      
FrameCapturedStatus             
FrameEdges                      
FrameSourceTypes                
HandState                       
JointType                       
KinectCapabilities              
KinectStatus                    
TrackingConfidence              
TrackingState                   
IBody                          
IFrameDescription              
IColorCameraSettings           
IIsAvailableChangedEventArgs   
IFrameCapturedEventArgs        
ICoordinateMappingChangedEventArgs 
ICoordinateMapper              
IBodyFrame                     
IBodyFrameReference            
IBodyFrameArrivedEventArgs     
IBodyFrameReader               
IBodyFrameSource               
IBodyIndexFrame                
IBodyIndexFrameReference       
IBodyIndexFrameArrivedEventArgs 
IBodyIndexFrameReader          
IBodyIndexFrameSource          
IColorFrame                    
IColorFrameReference           
IColorFrameArrivedEventArgs    
IColorFrameReader              
IColorFrameSource              
IDepthFrame                    
IDepthFrameReference           
IDepthFrameArrivedEventArgs    
IDepthFrameReader              
IDepthFrameSource              
IInfraredFrame                 
IInfraredFrameReference        
IInfraredFrameArrivedEventArgs 
IInfraredFrameReader           
IInfraredFrameSource           
ILongExposureInfraredFrame     
ILongExposureInfraredFrameReference 
ILongExposureInfraredFrameArrivedEventArgs 
ILongExposureInfraredFrameReader 
ILongExposureInfraredFrameSource 
IMultiSourceFrameArrivedEventArgs 
IMultiSourceFrameReader        
IKinectSensor                  
IMultiSourceFrame              
IMultiSourceFrameReference     
IEnumKinectSensor              
IKinectSensorCollection

Technorati Tags: Windows,Windows programming,Kinect,C#,XAML,Direct2D