Skeleton Basics-D2D C++ Sample

Kinect for Windows 1.5, 1.6, 1.7, 1.8


When you run this sample, you see the following:

  • Skeleton tracking for up to two players standing in front of the Kinect; 20 joints per skeleton are rendered.
  • A checkbox for seated mode. If you select this, you will see skeleton tracking for up to two players while seated; 10 joints per skeleton are rendered.
The Sample Uses the Following APIsTo Do This
NuiGetSensorCount functionGet the number of sensors that are plugged in and ready for use.
NuiCreateSensorByIndex function and INuiSensor interfaceCreate an interface that represents a connected sensor.
INuiSensor::NuiStatus methodCheck the sensor status to see if the sensor is connected.
INuiSensor::NuiInitialize method and NUI_INITIALIZE_FLAG_USES_SKELETON constantInitialize the sensor to stream out skeleton data.
CreateEvent functionCreate an event that will be signaled when skeleton data is available by returning an event handle.
INuiSensor::NuiSkeletonTrackingEnable method and the event handleEnable skeleton tracking.
NUI_SKELETON_FRAME structure and INuiSensor::NuiSkeletonGetNextFrame methodGet a frame of skeleton data.
INuiSensor::NuiTransformSmooth methodSmooth the skeleton data using a matrix transformation.
NUI_SKELETON_TRACKING_STATE enumerationCheck a joint to see if it is tracked.
NuiTransformSkeletonToDepthImage functionConvert points from skeleton space to depth space so you can position the skeleton on screen.
NUI_SKELETON_POSITION_TRACKING_STATE enumerationFor each frame of skeleton data, use the enumeration value to distinguish a tracked joint (NUI_SKELETON_POSITION_TRACKED) from an untracked (NUI_SKELETON_POSITION_NOT_TRACKED) or an inferred (NUI_SKELETON_POSITION_INFERRED) joint.
NuiShutdown functionTurn the sensor off.

To run a sample you must have the Kinect for Windows SDK installed. To compile a sample, you must have the developer toolkit installed. The latest SDK and developer toolkit are available on the developer download page. If you need help installing the toolkit, look on this page: To Install the SDK and Toolkit. The toolkit includes a sample browser, which you can use to launch a sample or download it to your machine. To open the sample browser, click Start > All Programs > Kinect for Windows SDK [version number] > Developer Toolkit Browser.

If you need help loading a sample in Visual Studio or using Visual Studio to compile, run, or debug, see Opening, Building, and Running Samples in Visual Studio.