Face Tracking 3D-WPF C# Sample
Kinect for Windows 1.5, 1.6, 1.7, 1.8
Overview
When you run this sample, you see the following:
- The scene in front of the camera is rendered.
- Once your skeleton is tracked, a mask is rendered hovering over the face and the mask tracks the movement of the player's face through the scene. This is similar to the Face Tracking Basics-WPF C# Sample.
- In addition, this sample applies the color data to the triangles in the mask so the mask is rendered using the person's face.
The Sample Uses the Following APIs | To Do This |
---|---|
KinectSensor.Start Method and KinectSensor.Stop Method methods | Start or stop streaming data. |
ColorImageStream.Enable Method and ColorImageFormat.RgbResolution640x480Fps30 enumeration value | Choose the color format and enable the sensor to stream out color data. |
DepthImageStream.Enable Method and DepthImageFormat.Resolution320x240Fps30 enumeration value | Choose the depth format and enable the sensor to stream out depth data. |
DepthImageStream.Range Property | Set the sensor depth to near mode. |
SkeletonStream.EnableTrackingInNearRange Property | Enable skeleton tracking while the depth stream is in near mode. |
SkeletonStream.TrackingMode Property and SkeletonTrackingMode.Seated enumeration value | Enable skeleton tracking in seated mode. |
SkeletonStream.Enable Method | Enable the sensor to stream out skeleton data. |
KinectSensor.AllFramesReady Event | Add an event handler for all the streams. The sensor will signal the event handler when each new frame of color, depth, and skeleton data is ready. |
ColorImageFrameReadyEventArgs.OpenColorImageFrame Method | Get a frame of color data in the event handler. |
ColorImageFrame.CopyPixelDataTo Method | Copy a frame of color data to a pre-allocated array, so it can then be written to an optional WriteableBitmap. |
Skeleton Class | Use the collection of skeletons to get data for a particular skeleton. |
Skeleton.TrackingState Property, SkeletonTrackingState.Tracked and SkeletonTrackingState.PositionOnly enumeration values, Skeleton.TrackingId Property | Determine if a skeleton is tracked and get its tracking ID. |
SkeletonFaceTracker class | A custom class for storing skeleton data and drawing a face grid positioned over a skeleton head. |
FaceTrackFrame class | A custom class that detects a face based on the Kinect input data, identifies characteristic points and tracks the face as it moves. |
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.