Kinect Explorer - D2D C++ Sample

Kinect for Windows 1.7, 1.8

Overview

When you run this sample, you see the following:

  • The color stream, showing the video being captured, with the frame rate in the upper right.
  • The depth stream, showing depth of people and objects in different colors. Darker shades are farther from the sensor.
  • A panel on the right, with three tabs:

    • Audio, which displays the audio properties (beam angle, source angle, and confidence),
    • Accelerometer, which displays the current accelerometer reading,
    • Sensor Settings, which allows you to view and adjust the sensor tilt angle. This panel also allows you to turn the infrared sensor on and off. Note that when the infrared sensor is off, the depth window goes dark. The infrared sensor is used to gather depth data.
  • A series of tabs at the top which allow configuration of the various streams.
    • The Color Stream tab allows you to pause and unpause the color camera stream, and allows you to set the resolution and the data encoding for the stream.
    • The Depth Stream tab allows you to:
      • Pause and unpause the depth image stream
      • Set the range mode from default mode to near mode and back again
      • Set the resolution of the depth stream
      • Specify how to handle unreliable depth values (ones that are too far away or too close).
    • The Skeleton Stream tab allows you to
      • Pause and unpause the skeleton stream
      • Switch the tracking mode between default and seated mode
      • Choose between skeleton tracking options (track one player or two players, track most active players, etc).
    • The Camera tab allow you to configure settings for the color camera, including brightness, gamma, and so forth.
    • The Switch tab swaps the color stream and the depth stream between the two active display windows.
The Sample Uses the Following APIsTo Do This
NuiGetSensorCount FunctionGet the number of sensors that are 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 the NUI_INITIALIZE_FLAG_USES_DEPTH_AND_PLAYER_INDEX, NUI_INITIALIZE_FLAG_USES_SKELETON, NUI_INITIALIZE_FLAG_USES_COLOR, and NUI_INITIALIZE_FLAG_USES_AUDIO constantsInitialize the sensor to stream out depth data, player index, skeleton data, color images, and audio data.
CreateEvent FunctionCreate an event that will be signaled when data is available by returning an event handle.
INuiSensor::NuiImageStreamOpen Method, NUI_IMAGE_TYPE_COLOR constant, NUI_IMAGE_TYPE_DEPTH constant, and the event handleOpen an image stream (depth or color) to receive data.
NUI_IMAGE_RESOLUTION constant Specify the color camera or depth camera resolution. All resolutions can be set in this sample through the Color Stream or Depth Stream tabs.
INuiSensor::NuiImageStreamGetNextFrame MethodGet the next frame of image data (using the data event handle).
INuiSensor::NuiAccelerometerGetCurrentReading Method Retrieve the current accelerometer reading.
INuiSensor::NuiImageStreamReleaseFrame MethodRelease each frame of image data after saving it.
INuiSensor::Release MethodRelease the sensor when you exit the application.

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

ADD
Show: