Exemple #1
0
        static void Main(string[] args)
        {
            var capture = new Capture();

            using (Mat nextFrame = capture.QueryFrame())
            {
                if (nextFrame != null)
                {
                    FaceDetectionEngine  faceDetectionEngine  = CommonOperations.faceDetectionEngine;
                    FaceRecognizerEngine faceRecognizerEngine = CommonOperations.faceRecognizerEngine;
                    var faceAreas = faceDetectionEngine.extractFaceAreas(nextFrame);
                    if (faceAreas != null && faceAreas.Length > 0)
                    {
                        foreach (var face in faceAreas)
                        {
                            var result = faceRecognizerEngine.RecognizePerson(face);
                            if (result < 1)
                            {
                                faceDetectionEngine.saveFace(face);
                            }
                            else
                            {
                                Debugger.writeLine("ID of person recognized is " + result);
                                string personName = CommonOperations.dBOperations.GetPersonName(result);
                                MessageBox.Show("This face belongs to " + personName, "Face Recognizition");
                            }
                        }
                    }
                }
            }
        }
 public static void initializeApplication()
 {
     dBOperations         = DBOperations.createInstance();
     faceDetectionEngine  = new FaceDetectionEngine();
     faceRecognizerEngine = new FaceRecognizerEngine(dBOperations);
     checkHaarClassifierFile();
     checkEigenFaceRecognizerTrainedFile();
 }