Search code examples
c#sdkkinectface-recognitiondepth

Obtaining Depth Information of Facial Points Using Kinect


I am currently tracking a face using Microsoft's SDK and can detect 121 points on a face. I can get the co-ordinates of the points in the following manor:

            if (!this.lastFaceTrackSucceeded || this.skeletonTrackingState != SkeletonTrackingState.Tracked)
                return;

            var faceModelPts = new List<Point>();
            var faceModel = new List<FaceModelTriangle>();

            for (int i = 0; i < this.facePoints.Count; i++)
            {
                faceModelPts.Add(new Point(this.facePoints[i].X + 0.5f, this.facePoints[i].Y + 0.5f));
                FaceDataPoints.XPointInfo[i] = this.facePoints[i].X;
                FaceDataPoints.YPointInfo[i] = this.facePoints[i].Y;
            }

But these points appear to be the co-ordinates for the colour image. How do I go about getting the respective depth information about each of these pixels. Such as point "20" on the users face?


Solution

  • Found the answer

    "GetProjected3DShape" shape holds 2D coordinates used by the face tracking basics

    To obtain the depth information use "Get3DShape"

    comparison of the 2

            private EnumIndexableCollection<FeaturePoint, PointF> ColourPoints;
    
            private EnumIndexableCollection<FeaturePoint, Vector3DF> DepthPoints;
    

    Depth points hold the information for the X,Y and Z co-ordinates for each of the facial points