Export (0) Print
Expand All

Depth Basics-WPF-VB Sample

Kinect for Windows 1.5, 1.6, 1.7, 1.8

Overview

When you run this sample, you see the following:

  • The depth data is captured and displayed; this is a continuously streaming grayscale image of the distance between the sensor and whatever the Kinect is pointed at. The camera can see pixels inside of the interaction space, which are colored shades of gray or white; the pixels that are outside of the interaction space are colored black.
  • A checkbox to set the sensor to near mode.
  • Click Screenshot to capture the screen and save it in a file.

The Sample Uses the Following APIsTo Do This
KinectSensor.KinectSensors PropertyGet the Kinect sensors that are plugged in and ready for use.
DepthImageFormat.Resolution640x480FPS30 enumeration valueChoose the depth stream format including the data type, resolution, and frame rate of the data.
DepthImageStream.Enable MethodEnable the depth stream.
ImageStream.FramePixelDataLength PropertySpecify the length of the pixel data buffer when you allocate memory to store the depth stream data from the sensor.
ImageStream.FrameWidth Property and ImageStream.FrameHeight PropertySpecify the width and height of the frame data to use a WriteableBitmap to store/render the depth data.
KinectSensor.DepthFrameReady EventAdd an event handler for the depth data. The sensor will signal the event handler when each new frame of depth data is ready.
KinectSensor.Start Method and KinectSensor.Stop MethodStart or stop streaming data.
DepthImageFrameReadyEventArgs.OpenDepthImageFrame MethodGet a frame of depth data, in the event handler.
DepthImageFrame.CopyDepthImagePixelDataTo MethodCopy a frame of depth data to a pre-allocated array, so it can then be written to an optional WriteableBitmap.

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