Skeletal Viewer C++ Sample

Kinect for Windows 1.5, 1.6


When you run this sample, you see the following:

  • The Depth View, showing background in grayscale and different people in different colors. Darker colors mean more distance from the sensor. People are detected only if their entire body fits within the captured frame.
  • The Skeletal View, showing tracked skeletons only if the entire body of at least one person fits within the captured frame.
  • The Color View, showing the video being captured.
  • The frame rate of the data capture.
The Sample Uses the Following APIsTo Do This
NuiGetSensorCountGet 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_COLOR constantInitialize the sensor to stream out color data.
INuiSensor::NuiSkeletonTrackingEnable MethodOpen a skeleton stream to receive skeleton data.
NUI_SKELETON_FRAME Structure and INuiSensor::NuiSkeletonGetNextFrame MethodGet a frame of skeleton data.
INuiSensor::NuiTransformSmooth MethodSmooth out the skeleton data.
NUI_SKELETON_TRACKING_STATE enumerationMake sure that all joints in the skeleton are being tracked.
NuiTransformSkeletonToDepthImage(Vector4, LONG*, LONG*, USHORT*, NUI_IMAGE_RESOLUTION)Return coordinates in NUI_IMAGE_RESOUTION_320x240 space.
NUI_SKELETON_POSITION_TRACKING_STATE enumerationMake sure each joint is being tracked before displaying it.
NuiShutdownTurn 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.

Community Additions