C# Class Microsoft.Kinect.Toolkit.FaceTracking.FaceTracker

Main class that instantiates the face tracking engine and tracks the faces of a single person retrieving various metrics like animation units, 3D points and triangles on the face.
Inheritance: IDisposable
Show file Open project: ushadow/handinput Class Usage Examples

Private Properties

Property Type Description
CheckPtrAndThrow void
CreateResult Microsoft.Kinect.Toolkit.FaceTracking.FaceTrackFrame
DepthToColorCallback int
GetHeadPointsFromSkeleton Vector3DF[]
Initialize void
Track FaceTrackFrame

Public Methods

Method Description
Dispose ( ) : void

Disposes of the face tracking engine

FaceTracker ( KinectSensor sensor ) : System

Initializes a new instance of the FaceTracker class from a reference of the Kinect device. Reference to kinect sensor instance

ResetTracking ( ) : void

Resets IFTFaceTracker instance to the clean state (like it is in right after the call to Initialize() method)

Track ( ColorImageFormat colorImageFormat, byte colorImage, DepthImageFormat depthImageFormat, short depthImage ) : FaceTrackFrame

Starts face tracking from Kinect input data. Track() detects a face based on the passed parameters, then identifies characteristic points and begins tracking. The first call to this API is more expensive, but if the tracking succeeds then subsequent calls use the tracking information generated from first call and is faster, until a tracking failure happens.

Track ( ColorImageFormat colorImageFormat, byte colorImage, DepthImageFormat depthImageFormat, short depthImage, Rect regionOfInterest ) : FaceTrackFrame

Starts face tracking from Kinect input data. Track() detects a face based on the passed parameters, then identifies characteristic points and begins tracking. The first call to this API is more expensive, but if the tracking succeeds then subsequent calls use the tracking information generated from first call and is faster, until a tracking failure happens.

Track ( ColorImageFormat colorImageFormat, byte colorImage, DepthImageFormat depthImageFormat, short depthImage, Skeleton skeletonOfInterest ) : FaceTrackFrame

Starts face tracking from Kinect input data. Track() detects a face based on the passed parameters, then identifies characteristic points and begins tracking. The first call to this API is more expensive, but if the tracking succeeds then subsequent calls use the tracking information generated from first call and is faster, until a tracking failure happens.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Allows calling dispose explicitly or from the finalizer

Private Methods

Method Description
CheckPtrAndThrow ( ) : void
CreateResult ( int &hr ) : Microsoft.Kinect.Toolkit.FaceTracking.FaceTrackFrame

Creates a frame object instance. Can be used for caching of the face tracking frame. FaceTrackFrame should be disposed after use.

DepthToColorCallback ( uint depthFrameWidth, uint depthFrameHeight, uint colorFrameWidth, uint colorFrameHeight, float zoomFactor, Point viewOffset, int depthX, int depthY, ushort depthZ, int &colorX, int &colorY ) : int

Callback to help with mapping depth pixel to color pixel data. Uses Kinect sensor's MapDepthToColorImagePoint to do the conversion

GetHeadPointsFromSkeleton ( Skeleton skeletonOfInterest ) : Vector3DF[]

Helper API to retrieve head points structure from a given skeleton instance

Initialize ( CameraConfig newColorCameraConfig, CameraConfig newDepthCameraConfig, IntPtr colorImagePtr, IntPtr depthImagePtr, FaceTrackingRegisterDepthToColor newRegisterDepthToColorDelegate ) : void

Helper method that does the core instantiation & initialization of face tracking engine

Track ( ColorImageFormat colorImageFormat, byte colorImage, DepthImageFormat depthImageFormat, short depthImage, Skeleton skeletonOfInterest, Rect regionOfInterest ) : FaceTrackFrame

Starts face tracking from Kinect input data. Track() detects a face based on the passed parameters, then identifies characteristic points and begins tracking. The first call to this API is more expensive, but if the tracking succeeds then subsequent calls use the tracking information generated from first call and is faster, until a tracking failure happens.

Method Details

Dispose() public method

Disposes of the face tracking engine
public Dispose ( ) : void
return void

Dispose() protected method

Allows calling dispose explicitly or from the finalizer
protected Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; false to release only unmanaged resources
return void

FaceTracker() public method

Initializes a new instance of the FaceTracker class from a reference of the Kinect device. Reference to kinect sensor instance
public FaceTracker ( KinectSensor sensor ) : System
sensor KinectSensor
return System

ResetTracking() public method

Resets IFTFaceTracker instance to the clean state (like it is in right after the call to Initialize() method)
public ResetTracking ( ) : void
return void

Track() public method

Starts face tracking from Kinect input data. Track() detects a face based on the passed parameters, then identifies characteristic points and begins tracking. The first call to this API is more expensive, but if the tracking succeeds then subsequent calls use the tracking information generated from first call and is faster, until a tracking failure happens.
public Track ( ColorImageFormat colorImageFormat, byte colorImage, DepthImageFormat depthImageFormat, short depthImage ) : FaceTrackFrame
colorImageFormat ColorImageFormat /// format of the colorImage array ///
colorImage byte /// Input color image frame retrieved from Kinect sensor ///
depthImageFormat DepthImageFormat /// format of the depthImage array ///
depthImage short /// Input depth image frame retrieved from Kinect sensor ///
return FaceTrackFrame

Track() public method

Starts face tracking from Kinect input data. Track() detects a face based on the passed parameters, then identifies characteristic points and begins tracking. The first call to this API is more expensive, but if the tracking succeeds then subsequent calls use the tracking information generated from first call and is faster, until a tracking failure happens.
public Track ( ColorImageFormat colorImageFormat, byte colorImage, DepthImageFormat depthImageFormat, short depthImage, Rect regionOfInterest ) : FaceTrackFrame
colorImageFormat ColorImageFormat /// format of the colorImage array ///
colorImage byte /// Input color image frame retrieved from Kinect sensor ///
depthImageFormat DepthImageFormat /// format of the depthImage array ///
depthImage short /// Input depth image frame retrieved from Kinect sensor ///
regionOfInterest Rect /// Region of interest in the passed video frame where the face tracker should search for a face to initiate tracking. /// Passing Rectangle.Empty (default) causes the entire frame to be searched. ///
return FaceTrackFrame

Track() public method

Starts face tracking from Kinect input data. Track() detects a face based on the passed parameters, then identifies characteristic points and begins tracking. The first call to this API is more expensive, but if the tracking succeeds then subsequent calls use the tracking information generated from first call and is faster, until a tracking failure happens.
public Track ( ColorImageFormat colorImageFormat, byte colorImage, DepthImageFormat depthImageFormat, short depthImage, Skeleton skeletonOfInterest ) : FaceTrackFrame
colorImageFormat ColorImageFormat format of the colorImage array
colorImage byte Input color image frame retrieved from Kinect sensor
depthImageFormat DepthImageFormat format of the depthImage array
depthImage short Input depth image frame retrieved from Kinect sensor
skeletonOfInterest Skeleton Input skeleton to track. Head and shoulder joints in the skeleton are used to calculate the head vector
return FaceTrackFrame