如何使用MS kinect SDK从C#生成的文本文件中保存特征点的面坐标(X,Y)? [英] How to save face coordinates(X,Y) of feature points in a generated text file from C# using MS kinect SDK?

查看:77
本文介绍了如何使用MS kinect SDK从C#生成的文本文件中保存特征点的面坐标(X,Y)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在使用Microsoft kinect SDK进行面部跟踪和开发情感检测算法。在面部实时应用面罩后,我试图通过计算特征点之间的距离来提取一些特征,并且我有
来提取某些点的(x,y)坐标。 " .TXT"包含要素点索引的文件,后跟循环中单独行中每个点的坐标。我试图在一个新的数组中复制特征点,例如X的
数组和Y坐标的另一个:

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;
        }



但是我收到了这个错误:"NullReferenceException未处理"出现在A_array [i] = this.facePoints [i] .X;我的问题是如何获取访问权限为了在文本文件中获取它们的连续值
,为了这些点的坐标协调它们以及我可以使用哪个函数,我已经尝试了几次stream.writer但它使得没有意义,我可以将面部点的元素值返回到数据类型并将它们分配给变量吗?

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?

推荐答案

您确定吗?在尝试访问其属性之前,FaceFrameResult不为null?如果从face api获取有效的FaceFrameResult,可以通过FacePointsInXXX属性访问Kinect中的数据,如FaceBasics-WPF
示例中所示。

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);
    }
}


这篇关于如何使用MS kinect SDK从C#生成的文本文件中保存特征点的面坐标(X,Y)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆