Depth Basics-D2D C++ Sample
Kinect for Windows 1.5, 1.6, 1.7, 1.8
When you run this sample, you see the following:
- The depth data is captured and displayed as a grayscale image of the distance between the sensor and whatever is in front of the sensor. The sample displays pixels within the interaction space shaded gray or white; pixels outside of the interaction space are colored black.
- A checkbox to change the depth range to near range.
|The Sample Uses the Following APIs||To Do This|
|NuiGetSensorCount Function||Get the number of sensors that are ready for use.|
|NuiCreateSensorByIndex Function and INuiSensor interface||Create an interface that represents a connected sensor.|
|INuiSensor::NuiStatus Method||Check the sensor status to see if the sensor is connected.|
|INuiSensor::NuiInitialize Method and NUI_INITIALIZE_FLAG_USES_DEPTH constant||Initialize the sensor to stream out depth data.|
|CreateEvent Function||Create an event that will be signaled when depth data is available by returning an event handle.|
|INuiSensor::NuiImageStreamOpen Method, NUI_IMAGE_TYPE_DEPTH constant, NUI_IMAGE_RESOLUTION_640x480 constant, and the event handle||Open a depth stream to receive depth data.|
|INuiSensor::NuiImageStreamGetNextFrame Method||Get the next frame of depth data (using the depth data event handle).|
|INuiSensor::NuiImageStreamReleaseFrame Method||Release each frame of color data after saving it.|
|INuiSensor::Release Method||Release 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.