示例#1
0
        public static FaceCalculationsItem GetFaceCalculationsFromShape(PointF[] shape)
        {
            float leftEyeArea =
                AreaForTriangle(shape[0], shape[1], shape[7]) +
                AreaForTriangle(shape[1], shape[2], shape[7]) +
                AreaForTriangle(shape[2], shape[6], shape[7]) +
                AreaForTriangle(shape[2], shape[3], shape[6]) +
                AreaForTriangle(shape[3], shape[5], shape[6]) +
                AreaForTriangle(shape[3], shape[4], shape[5]);

            float rightEyeArea =
                AreaForTriangle(shape[8], shape[9], shape[15]) +
                AreaForTriangle(shape[9], shape[10], shape[15]) +
                AreaForTriangle(shape[10], shape[14], shape[15]) +
                AreaForTriangle(shape[10], shape[11], shape[14]) +
                AreaForTriangle(shape[11], shape[13], shape[14]) +
                AreaForTriangle(shape[11], shape[12], shape[13]);

            float mouthArea =
                AreaForTriangle(shape[60], shape[61], shape[67]) +
                AreaForTriangle(shape[61], shape[62], shape[67]) +
                AreaForTriangle(shape[62], shape[66], shape[67]) +
                AreaForTriangle(shape[62], shape[63], shape[66]) +
                AreaForTriangle(shape[63], shape[65], shape[66]) +
                AreaForTriangle(shape[63], shape[64], shape[65]);

            //float faceArea =
            //    AreaForTriangle(shape[68], new PointF(shape[68].X, shape[77].Y), shape[86]) +
            //    AreaForTriangle(shape[86], new PointF(shape[68].X, shape[77].Y), new PointF(shape[86].X, shape[77].Y));

            var faceCalculations = new FaceCalculationsItem();
            faceCalculations._0_TamplaStanga = DistanceBetweenPoints(shape[68], shape[69]);
            faceCalculations._1_TamplaDreapta = DistanceBetweenPoints(shape[86], shape[85]);
            faceCalculations._2_Barbie = DistanceBetweenPoints(shape[73], shape[81]);
            faceCalculations._3_SpranceanaDreapta = AngleMadeByPoints(shape[26], shape[27]);
            faceCalculations._4_ArieOchiStang = leftEyeArea.RoundTwoDigits();
            faceCalculations._5_ArieOchiDrept = rightEyeArea.RoundTwoDigits();
            faceCalculations._6_MarimeOchiStang = DistanceBetweenPoints(shape[2], shape[6]);
            faceCalculations._7_MarimeOchiDrept = DistanceBetweenPoints(shape[10], shape[14]);
            faceCalculations._8_InaltimeGura = DistanceBetweenPoints(shape[62], shape[66]);
            faceCalculations._9_Unghi_60_67 = DistanceBetweenPoints(shape[60], shape[67]);
            faceCalculations._10_Unghi_64_65 = AngleMadeByPoints(shape[64], shape[65]);
            faceCalculations._11_LungimeGuraExterior = DistanceBetweenPoints(shape[48], shape[54]);
            faceCalculations._12_UnghiNasStanga = AngleMadeByPoints(shape[39], shape[38]);
            faceCalculations._13_UnghiNasDreapta = AngleMadeByPoints(shape[45], shape[44]);
            faceCalculations._14_ArieFata = FaceArea(shape, 69);
            faceCalculations._15_ArieGura = mouthArea.RoundTwoDigits();

            return faceCalculations;
        }
示例#2
0
        public static string DisplayFaceCalculations(FaceCalculationsItem faceCalculatios)
        {
            var builder = new StringBuilder();

            builder.AppendLine("tampla stanga " + faceCalculatios._0_TamplaStanga);
            builder.AppendLine("tampla dreapta " + faceCalculatios._1_TamplaDreapta);
            builder.AppendLine("marime barbie " + faceCalculatios._2_Barbie);
            builder.AppendLine("unghi sprancene dreapta stanga " + faceCalculatios._3_SpranceanaDreapta);
            builder.AppendLine("arie ochi stang " + faceCalculatios._4_ArieOchiStang);
            builder.AppendLine("arie ochi drept " + faceCalculatios._5_ArieOchiDrept);
            builder.AppendLine("marime ochi stang " + faceCalculatios._6_MarimeOchiStang);
            builder.AppendLine("marime ochi drept " + faceCalculatios._7_MarimeOchiDrept);
            builder.AppendLine("marime gura " + faceCalculatios._8_InaltimeGura);
            builder.AppendLine("unghi gura stanga " + faceCalculatios._9_Unghi_60_67);
            builder.AppendLine("unghi gura dreapta " + faceCalculatios._10_Unghi_64_65);
            builder.AppendLine("lungime gura " + faceCalculatios._11_LungimeGuraExterior);
            builder.AppendLine("unghi nas stg" + faceCalculatios._12_UnghiNasStanga);
            builder.AppendLine("unghi nas dr" + faceCalculatios._13_UnghiNasDreapta);
            builder.AppendLine("arie fata" + faceCalculatios._14_ArieFata);
            builder.AppendLine("arie gura" + faceCalculatios._15_ArieGura);

            return builder.ToString();
        }
示例#3
0
        public static double[] FromFaceCalculationsToVector(FaceCalculationsItem calculations)
        {
            var result = new double[16];

            result[0] = calculations._0_TamplaStanga;
            result[1] = calculations._1_TamplaDreapta;
            result[2] = calculations._2_Barbie;
            result[3] = calculations._3_SpranceanaDreapta;
            result[4] = calculations._4_ArieOchiStang;
            result[5] = calculations._5_ArieOchiDrept;
            result[6] = calculations._6_MarimeOchiStang;
            result[7] = calculations._7_MarimeOchiDrept;
            result[8] = calculations._8_InaltimeGura;
            result[9] = calculations._9_Unghi_60_67;
            result[10] = calculations._10_Unghi_64_65;
            result[11] = calculations._11_LungimeGuraExterior;
            result[12] = calculations._12_UnghiNasStanga;
            result[13] = calculations._13_UnghiNasDreapta;
            result[14] = calculations._14_ArieFata;
            result[15] = calculations._15_ArieGura;

            return result;
        }