Export (0) Print
Expand All

Coordinate Mapping Basics-D2D C++ Sample

Kinect for Windows 1.5, 1.6, 1.7, 1.8

Hh973084.note(en-us,IEB.10).gifNote
Before Kinect for Windows SDK 1.8, this sample was named Green Screen-D2D C++ Sample.

Overview

When you run this sample, you see the following:

  • A background image.
  • If you move in front of the camera, your body is rendered over the background image. This is done using the depth data to choose the pixel color.
  • Click Near Mode to change the range of the depth data.
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 NUI_INITIALIZE_FLAG_USES_DEPTH_AND_PLAYER_INDEX and NUI_INITIALIZE_FLAG_USES_COLOR constantsInitialize the sensor to stream out depth and color data.
CreateEvent functionCreate an event that will be signaled when color data is available by returning an event handle.
INuiSensor::NuiImageStreamOpen method, NUI_IMAGE_TYPE_DEPTH_AND_PLAYER_INDEX constant, NUI_IMAGE_RESOLUTION_320x240 constant, and the event handleOpen a depth stream to receive depth data.
INuiSensor::NuiImageGetColorPixelCoordinateFrameFromDepthPixelFrameAtResolution methodGet the pixel coordinates in color space that correspond to the specified pixel coordinates in depth space to compensate for the differences between the depth and color cameras.
INuiSensor::NuiImageStreamGetNextFrame methodOpen a stream (with the event just created) for storing color data from the sensor.
INuiSensor::NuiImageStreamReleaseFrame methodRelease each frame of 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:
© 2014 Microsoft