/// <summary> /// get the total dispplacement of points across all frames /// </summary> /// <param name="file"></param> public List <double> getOne(string file) { getForOneType = new List <List <double> >(); List <double> tempAll = new List <double>(); FFEA.Expression getDistance = new FFEA.Expression(); XmlSerializer deserializer = new XmlSerializer(typeof(FaceFeature)); TextReader reader = new StreamReader(file); getDistance = ((FaceFeature)deserializer.Deserialize(reader)).expression(); double res = 0; for (int i = 1; i < getDistance.expression.Count(); i++) { List <double> temp = new List <double>(); for (int k = 0; k < Enum.GetValues(typeof(FeaturePoints)).Length; k++) { temp.Add(Math.Round(Convert.ToDouble(getDistance.expression[i].Distances[k]), 9, MidpointRounding.AwayFromZero)); } getForOneType.Add(temp); } for (int k = 0; k < storeFeaturePoint.Count(); k++) { for (int i = 1; i < getForOneType.Count() - 1; i++) { res = Math.Abs(getForOneType[i + 1][k] - getForOneType[i][k]); res = +res; } tempAll.Add(res * 1000); //get the average movement for selected across all frames } return(tempAll); }
//function to get the one footage's average distance movement acorss all frame public List <List <double> > decodeFootage(string file) { getForOneType = new List <List <double> >(); List <double> tempAll = new List <double>(); FFEA.Expression getDistance = new FFEA.Expression(); XmlSerializer deserializer = new XmlSerializer(typeof(FaceFeature)); TextReader reader = new StreamReader(file); getDistance = ((FaceFeature)deserializer.Deserialize(reader)).expression(); for (int i = 1; i < getDistance.expression.Count(); i++) { List <double> temp = new List <double>(); for (int k = 0; k < Enum.GetValues(typeof(FeaturePoints)).Length; k++) { temp.Add(Math.Round(Convert.ToDouble(getDistance.expression[i].Distances[k]), 9, MidpointRounding.AwayFromZero)); } getForOneType.Add(temp); } return(getForOneType); }