Tracking Skeletons in Near Depth Range

Kinect for Windows 1.5, 1.6, 1.7, 1.8

Starting from Kinect for Windows SDK 1.5, skeletons can be fully tracked when the depth sensor is set to near range.

In SDK 1.0, when an application sets the depth stream to near range, skeletal tracking returns position-only tracked skeletons without the possibility of getting the full skeletal joint positions. With SDK 1.5, an application can receive full joint information when tracking users as close to the sensor as 0.4 meters in this range setting (up to a maximum of 3.0 meters).

For details on the near range depth setting, see DepthRange Enumeration.

Skeletal tracking for near range is provided in both modes: seated and default. Given that the field of view is limited when the user is close, the seated mode is more frequently used in this case: applications can ensure that the user’s head, torso, and arms are visible and track only the user’s upper body.

Hh855353.note(en-us,IEB.10).gifNote
To ensure full backward compatibility with SDK 1.0, an existing application must explicitly enable full skeletal tracking in near depth range.

For more information on seated mode tracking, see Tracking Modes (Seated and Default) and the Human Interface Guidelines.

How to Track Skeletons in Near Depth Range in C#

During application initialization, set the EnableTrackingInNearRange property to true.

  // enable returning skeletons while depth is in Near Range
  this.kinect.SkeletonStream.EnableTrackingInNearRange = true;

Set the Range property to DepthRange.Near or DepthRange.Default, as desired.

  private void EnableNearModeSkeletalTracking()
  {
      if (this.kinect != null && this.kinect.DepthStream != null && this.kinect.SkeletonStream != null)
      {
          this.kinect.DepthStream.Range = DepthRange.Near; // Depth in near range enabled
          this.kinect.SkeletonStream.EnableTrackingInNearRange = true; // enable returning skeletons while depth is in Near Range
          this.kinect.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated; // Use seated tracking
      }
  }

How to Track Skeletons in Near Depth Range in C++

Whenever you call NuiSkeletonTrackingEnable, include the NUI_SKELETON_TRACKING_FLAG_ENABLE_IN_NEAR_RANGE flag.

  hr = m_pNuiSensor->NuiSkeletonTrackingEnable(m_hNextSkeletonEvent, 
         NUI_SKELETON_TRACKING_FLAG_ENABLE_IN_NEAR_RANGE | NUI_SKELETON_TRACKING_FLAG_ENABLE_SEATED_SUPPORT);

To enable the near range, open the depth image stream by calling NuiImageStreamOpen, passing the NUI_IMAGE_STREAM_FLAG_ENABLE_NEAR_MODE flag.

  hr = m_pNuiSensor->NuiImageStreamOpen(
      NUI_IMAGE_TYPE_DEPTH_AND_PLAYER_INDEX,
      NUI_IMAGE_RESOLUTION_320x240,
      NUI_IMAGE_STREAM_FLAG_ENABLE_NEAR_MODE,
      NUI_IMAGE_STREAM_FRAME_LIMIT_MAXIMUM,
      NULL,
      &m_hDepthStream);

If the depth image stream is already open, it is possible to change the depth range without re-opening it; call NuiImageStreamSetImageFrameFlags instead.

  hr = m_pNuiSensor->NuiImageStreamSetImageFrameFlags(
      m_hDepthStream,
      NUI_IMAGE_STREAM_FLAG_ENABLE_NEAR_MODE);

To return to the default range, call NuiImageStreamSetImageFrameFlags again, omitting the near mode flag.

Community Additions

ADD
Show: