Microsft Kinect for Windows

Keywords:
Microsoft, Depth, Sensor, Kinect, Skeleton
Author(s): Tobias Alexander Franke
Date: 2013-10-06

Summary: This tutorial describes the Kinect node, which is an InstantIO implementation of the Microsoft Kinect SDK.

Microsoft Kinect for Windows

Since Microsoft put out a standalon version of the Kinect camera for Windows, it also published its own SDK. While there are many similarities to the OpenNI implementation, the differences, especially focusing on skeleton tracking, may be worth looking into. Another potential benefit is the near field mode of a Kinect camera for Windows, which is able to provide depth data closer to the camera. In this tutorial, we will create a Kinect node to access skeleton data.

Prerequisites

Using the Kinect node requires an installation of the Microsoft Kinect SDK for Windows. The installer will take care of everything, including driver installation. Please note that this SDK can only be used with a Microsoft Kinect for Windows. You may also want to watch out for existing installations of OpenNI and NITE (both version 1.x) and avin2 drivers, which can interfere with the regular driver installation.

Make sure your driver installation is correct by testing one of the sample apps in the Kinect for Windows Developer Toolkit.

The node

Instantiating a Kinect for Windows node

The Kinect node in its complete instantiation is accessed via InstantIO as follows:

Code: OpenNI InstantIO node

<IOSensor DEF='kinect' type='Kinect' DeviceID='0' Width='640' Height='480' FPS='30' AlignViewpoints='TRUE' NormalizeDepth='TRUE' EnableNearMode='FALSE' FlipImages='FALSE'>
    <field accessType='outputOnly'  name='Image'                type='SFImage'/>
    <field accessType='outputOnly'  name='Depth'                type='SFImage'/>
    <field accessType='outputOnly'  name='UserMask'             type='SFImage'/>
    <field accessType='outputOnly'  name='TrackedUsers'         type='MFInt32'/>
    <field accessType='outputOnly'  name='NumUsers'             type='SFInt32'/>
    <field accessType='outputOnly'  name='JointPositions'       type='MFVec3f'/>   
    <field accessType='outputOnly'  name='SkeletonConfidence'   type='MFFloat'/>
    <field accessType='outputOnly'  name='ElevationAngle'        type='SFInt32'/>
    
    <field accessType='inputOnly'   name='ResetTrackedUsers'    type='SFBool'/>
    <field accessType='inputOnly'   name='NewElevationAngle'    type='SFInt32'/>
</IOSensor>

Accessing a skeleton

The first step is to create a device in your X3D file. We will use an IOSensor node with two fields, Depth and JointPositions. We will also set up an ImageBackground where we display the Depth image, and two nodes to fill in the skeleton with connecting lines between joints.

Code: Hooking up a kinect device to our X3D example

<IOSensor DEF='kinect' type='Kinect' FlipImages='TRUE'>
    <field accessType='outputOnly'  name='Depth'           type='SFImage'/>
    <field accessType='outputOnly'  name='JointPositions'  type='MFVec3f'/>
</IOSensor>

<ImageBackground>
    <PixelTexture2D DEF='image'/>
</ImageBackground>

<Group DEF='skeleton'>
</Group>

<Shape DEF='lines'>
    <Appearance>
        <LineProperties linewidthScaleFactor='4'/>
        <Material emissiveColor='0 1 0'/>
    </Appearance>
</Shape>

After this setup we will need a script to grab the arrays provided by the Kinect node and create joints (made from boxes) and connect the right ones with lines together. Please have a look in the source file attached for more details!

Files: