none
How to save face coordinates(X,Y) of feature points in a generated text file from C# using MS kinect SDK? RRS feed

  • Question

  • I am using Microsoft kinect SDK for face tracking and developing an emotion detection algorithm. After the face mask is applied on the face in real time, I am trying to extract some features by calculating the distances between the feature points and I have to extract the (x,y) co-ordinates for some points in ".txt" file that would contain the feature point index followed by the coordinates for each point in a separate lines in a loop. I have tried to copy the feature points in a new array such as an array for X and another one for Y co-ordinates:

            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 ,  this.facePoints[i].Y));
                A_array[i] = this.facePoints[i].X;
                B_array[i] = this.facePoints[i].Y;
            }

    But I'm getting this error : "NullReferenceException was unhandled" appears on A_array[i] = this.facePoints[i].X; My question is how can I get access to these points co-ordinates to copy them in an array in order to get the continuous values of them in a text file?and which function can I use for this, I have tried stream.writer several times but it makes no sense and can I return the values of the elements of face points to datatype and assign them in a variable?

    Friday, February 27, 2015 1:38 PM

All replies

  • Did you ensure the FaceFrameResult is not null before trying to access its properties? If you are getting a valid FaceFrameResult from face api, the data from Kinect can be accessed via FacePointsInXXX property as demonstrated in the FaceBasics-WPF sample.

    if (faceResult.FacePointsInColorSpace != null)
    {
        // draw each face point
        foreach (PointF pointF in faceResult.FacePointsInColorSpace.Values)
        {
            Point p = new Point(pointF.X, pointF.Y);
        }
    }
    

    Carmine Sirignano - MSFT


    Friday, February 27, 2015 7:36 PM
  • Hello. Do you got?
    Wednesday, January 17, 2018 6:33 PM