Пример #1
0
        public static bool FaceRecognizeAndSaveResults(OpenCvSharp.IplImage input, string saveDir, string filePahtPrefix)
        {
            input.SaveImage(System.IO.Path.GetFullPath("../python/input.png"));

            List <Tuple <string, RectangleF> > facesInfo = new List <Tuple <string, RectangleF> >();

            if (false == FaceRecognizeAndSaveResultsCommon(saveDir, filePahtPrefix, facesInfo))
            {
                return(false);
            }

            foreach (var info in facesInfo)
            {
                string     savePath = info.Item1;
                RectangleF face     = info.Item2;
                using (var faceImage = input.Clone(new OpenCvSharp.CvRect((int)face.X, (int)face.Y, (int)face.Width, (int)face.Height)))
                {
                    faceImage.SaveImage(savePath);
                }
            }

            return(true);
        }