Beispiel #1
0
 private void DoOnFaceFound(object sender, FaceFoundEventArgs args)
 {
     if (OnFaceFound != null)
     {
         OnFaceFound(sender, args);
     }
 }
Beispiel #2
0
 private void RecognizeFaces(object sender, FaceFoundEventArgs args)
 {
     using (Image <Bgr, byte> image = new Image <Bgr, byte>(args.FileName))
     {
         using (var face = image.Copy(args.Face).Convert <Gray, byte>().Resize(100, 100, Inter.Cubic))
         {
             PredictionResult prediction = _currentFaceRecognizer.Predict(face);
             if (prediction.Label > -1)
             {
                 DoOnFaceRecognized(this,
                                    new FaceRecognizedEventArgs()
                 {
                     Face     = args.Face,
                     FileName = args.FileName,
                     LabelId  = prediction.Label,
                     Label    = _faceLabels[prediction.Label]
                 });
             }
         }
     }
 }