示例#1
0
 private static PointF[] convertLandmarkFormation(
     ref FaceLandmarks _landmarks,
     ref FaceRectangle _rectangle)
 {
     PointF[] retLandmarks = new PointF[27] {
         convertPointFormation(_landmarks.EyebrowLeftOuter, _rectangle),
         convertPointFormation(_landmarks.EyebrowLeftInner, _rectangle),
         convertPointFormation(_landmarks.EyebrowRightOuter, _rectangle),
         convertPointFormation(_landmarks.EyebrowRightInner, _rectangle),
         convertPointFormation(_landmarks.EyeLeftOuter, _rectangle),
         convertPointFormation(_landmarks.EyeLeftTop, _rectangle),
         convertPointFormation(_landmarks.EyeLeftInner, _rectangle),
         convertPointFormation(_landmarks.EyeLeftBottom, _rectangle),
         convertPointFormation(_landmarks.PupilLeft, _rectangle),
         convertPointFormation(_landmarks.EyeRightOuter, _rectangle),
         convertPointFormation(_landmarks.EyeRightTop, _rectangle),
         convertPointFormation(_landmarks.EyeRightInner, _rectangle),
         convertPointFormation(_landmarks.EyeRightBottom, _rectangle),
         convertPointFormation(_landmarks.PupilRight, _rectangle),
         convertPointFormation(_landmarks.NoseRootLeft, _rectangle),
         convertPointFormation(_landmarks.NoseLeftAlarTop, _rectangle),
         convertPointFormation(_landmarks.NoseLeftAlarOutTip, _rectangle),
         convertPointFormation(_landmarks.NoseTip, _rectangle),
         convertPointFormation(_landmarks.NoseRightAlarOutTip, _rectangle),
         convertPointFormation(_landmarks.NoseRightAlarTop, _rectangle),
         convertPointFormation(_landmarks.NoseRootRight, _rectangle),
         convertPointFormation(_landmarks.MouthLeft, _rectangle),
         convertPointFormation(_landmarks.UpperLipTop, _rectangle),
         convertPointFormation(_landmarks.MouthRight, _rectangle),
         convertPointFormation(_landmarks.UnderLipBottom, _rectangle),
         convertPointFormation(_landmarks.UpperLipBottom, _rectangle),
         convertPointFormation(_landmarks.UnderLipTop, _rectangle)
     };
     return(retLandmarks);
 }
示例#2
0
        private static void runFaceAPI(
            string _filePath,
            out FaceRectangle[] _rects,
            out FaceLandmarks[] _landmarks)
        {
            string  key          = "1cdb412565ae43879ea8133525e89040";
            FaceAPI faceAPI      = new FaceAPI(key);
            var     detectResult = faceAPI.detectFaces(_filePath);

            Task.WaitAll(detectResult);
            if (detectResult.Result)
            {
                _rects     = faceAPI.getFaceRectangles();
                _landmarks = faceAPI.getFaceLandmarks();
            }
            else
            {
                _rects     = new FaceRectangle[0];
                _landmarks = new FaceLandmarks[0];
            }
        }