Ejemplo n.º 1
0
        private static void FindFaces(FaceDetector faceDetector, string imageFilePath, string outputFile, bool debug = true)
        {
            using Image <RgbaVector> image = Image.Load <RgbaVector>(imageFilePath);
            var predictions = faceDetector.DetectFaces(image, 0.8f, noneMaximaSuppression: false);

            Console.WriteLine($"found {predictions.Count} faces.");

            foreach (var prediction in predictions)
            {
                FaceDetector.DrawPrediction(image, prediction, Color.Green, 14);
                if (debug)
                {
                    FaceDetector.DrawYoloTiles(image, Color.Red);
                }
            }

            image.SaveAsPng(outputFile);
        }