Monday, January 06, 2014

Multiple Apps can use Kinect for Windows v2

One of the new features of the Kinect for Windows API is that multiple applications can simultaneously access the sensor, as demonstrated by this video:

This is an early preview of the new Kinect for Windows, so the device, software and documentation are all preliminary and subject to change.

The lower right hand corner of this video shows a console application, KinectService, that must be running in order to run the samples provided. It’s unclear what role the service will play in the future releases of the SDK but I’d expect that it runs as Windows Service or headless process running from the system tray.

The Kinect API has changed to reflect this ability. It’s a minor change that will break some of your existing v1 code, but should be relatively easy to port to v2. Previous versions of the API allowed you to access the sensor data by subscribing to events on the sensor. The new version of the API introduces a reader pattern that separates the events from the sensor. Each reader has access to their own frames, which should in theory allow for more modular applications.

Here’s a quick sample:

// v1
KinectSensor sensor = KinectSensor.Sensors[0];
sensor.DepthFrameReady += OnDepthFrameReady;

// v2
KinectSensor sensor = KinectSensor.Default;
DepthFrameReader reader = sensor.DepthFrameSource.OpenReader();
reader.FrameArrived += OnDepthFrameArrived;

This change is significant because most devices are exclusively locked to the application that is using it. This can be a real pain when your app crashes but doesn’t release the handle of the device.

I can see many options for this functionality:

  • A support engineer can remotely troubleshoot the environment setup without having to close the primary application
  • A background process could take periodic snapshots to produce timelapse videos of usage of your application
  • Applications produced by different vendors could simulatenously run on the same machine: A desktop application could dim the monitor when you're not looking at it while a gesture application augments your windows experience...

What will you do with this feature?