You are not logged in.
Pages: 1
Thank you for your answer Bob, yes that what I found out too about the constant and I looked on the net without a good result. For my project I use the kinect sensor and face tracking SDK to track a face a get facial feature points. I want to implement my own facial recognition system using these facial features, I wanted to compute distances between some feature points like distance between eyes, nose length and width, jaw width. If someone have some idea to help me that would be great. I tried to compute distance using normalized euclidean distance but the distance changes after a certain period of time, I think it's caused by incertity measure of the sensor. Thank you.
Okay,
1)Get the coordinates of these points (InnerLeftEyePoint = p1,InnerRightEyePoint = p2)
2) compute distance for these two points: (Xp1-Xp2)^2 / standardDeviation(Xp1,Xp2)+(Yp1-Yp2)^2 / standardDeviation(Yp1,Yp2)+(Zp1-Zp2)^2 / standardDeviation(Zp1,Zp2); here Xp1, Yp1, Zp1 are x,y,z coordinates of the point p1. ^2 means Power 2.
The problem is that is returns a constant equal to 2 because of the standard derivation of two points. I am looking for another formula to compute a distance that is scale invariant and invariant to rotation.
I am using C#, okay I'll write an algorithm:
algorithme MahalanobisDistances(faceTrackFrame: image where to look for the face points){
//ED: EyesDistance
double eyesDist = MahalanobisDist(LeftinnerCornerOfRightEyePoint,RightInnerCornerOfLeftEyePoint);
//do the same thing of the others distance: call MahanalobisDist method to compute distance between each two points
double eyesCornerDist = ...
double noseWidth = ...
...
//here I return all distance I computed in a Dictionnary(a list with indexes)
return new Dictionary<string,double>{{"ED",eyesDist},{"ECD",eyesCornerDist},{"NW",noseWidth},{"NL",noseLength},{"NMD",noseMouthDist}};
}
//The function I call to compute the mahalanobis distance between two points
algorithme MahanalobisDist(point1, point2)
{
//Create three vectors with the x,y,z coordinates of each point (will be used for standard derivation)
double[] xVector = new double[] { point1.X, point2.X };
double[] yVector = new double[] { point1.Y, point2.Y };
double[] zVector = new double[] { point1.Z, point2.Z };
// compute the distance between the two points,
//MinusX(point1,point2) = (point1.x - point2.x)^2
//MinusY(point1,point2) = (point1.y - point2.y)^2
//MinusZ(point1,point2) = (point1.z - point2.z)^2
double dist = Math.Abs((MinusX(p1, p2) / StandardDerivation(xVector)) + (MinusY(p1, p2)/StandardDerivation(yVector)) + (MinusZ(p1, p2)/ StandardDerivation(zVector)));
return dist;
}
I hope this is okay. Thank you for your concern.
Thank you for your answer. I think that is the reason why is returns the same constant everytime a face is in front of the kinect sensor. But I need to compute a distance between two points that is invariant to scale. Here is my code:
public static double MinusX(Vector3DF p1, Vector3DF p2)
{
return (p1.X - p2.X) * (p1.X - p2.X);
}
public static double MinusY(Vector3DF p1, Vector3DF p2)
{
return (p1.Y - p2.Y) * (p1.Y - p2.Y);
}
public static double MinusZ(Vector3DF p1, Vector3DF p2)
{
return (p1.Z - p2.Z) * (p1.Z - p2.Z);
}
public static Dictionary<string,double> MahanalobisDistances(FaceTrackFrame faceFrame)
{
Vector3DF eyesCenterVector = new Vector3DF(Math.Abs((faceFrame.Get3DShape()[FeaturePoint.InnerCornerLeftEye].X - faceFrame.Get3DShape()[FeaturePoint.InnerCornerRightEye].X)/2),
Math.Abs((faceFrame.Get3DShape()[FeaturePoint.InnerCornerLeftEye].Y - faceFrame.Get3DShape()[FeaturePoint.InnerCornerRightEye].Y)/2),
Math.Abs((faceFrame.Get3DShape()[FeaturePoint.InnerCornerLeftEye].Z - faceFrame.Get3DShape()[FeaturePoint.InnerCornerRightEye].Z)/2)
);
//ED: EyesDistance
double eyesDist = MahanalobisDistance(faceFrame.Get3DShape()[FeaturePoint.InnerCornerLeftEye], faceFrame.Get3DShape()[FeaturePoint.InnerCornerRightEye]);
//ECD: Eyes Corner Distance
double eyesCornerDist = MahanalobisDistance(faceFrame.Get3DShape()[FeaturePoint.OuterCornerOfLeftEye], faceFrame.Get3DShape()[FeaturePoint.OuterCornerOfRightEye]);
//NW: Nose Width
double noseWidth = MahanalobisDistance(faceFrame.Get3DShape()[26], faceFrame.Get3DShape()[59]);
//NL: Nose Length
double noseLength = MahanalobisDistance(faceFrame.Get3DShape()[37], faceFrame.Get3DShape()[39]);
//NMD: Nose Mouth Distance
double noseMouthDist = MahanalobisDistance(faceFrame.Get3DShape()[37], faceFrame.Get3DShape()[8]);
//SaveDistances(eyesDist, eyesCornerDist,noseWidth);
Console.WriteLine("ed"+eyesDist+" ecd "+eyesCornerDist+" nw "+noseWidth+" nl "+noseLength+" nmd "+noseMouthDist);
return new Dictionary<string,double>{{"ED",eyesDist},{"ECD",eyesCornerDist},{"NW",noseWidth},{"NL",noseLength},{"NMD",noseMouthDist}};
}
public static double MahanalobisDistance(Vector3DF p1, Vector3DF p2)
{
double[] xVector = new double[] { p1.X, p2.X };
double[] yVector = new double[] { p1.Y, p2.Y };
double[] zVector = new double[] { p1.Z, p2.Z };
double dist = Math.Abs((MinusX(p1, p2) / StandardDerivation(xVector)) + (MinusY(p1, p2)/StandardDerivation(yVector)) + (MinusZ(p1, p2)/ StandardDerivation(zVector)));
return dist;
}
Pages: 1