Пример #1
0
        private void ProcessSecurityFrame(object sender, EventArgs e)
        {
            //Get Current Frame
            Image <Bgr, byte>  currentFrame = capture.QueryFrame();
            Image <Gray, byte> grayFrame    = currentFrame.Convert <Gray, byte>();

            facePos = FaceDetection.Detect(grayFrame);
            SecurityStateManager.AddToHistory(grayFrame.Copy(), facePos);
            PrintInstruction();


            if (!facePos.Equals(Rectangle.Empty))
            {
                BlinkStateManager.faceDetected = true;
                Image <Gray, byte> faceImage = grayFrame.Copy(facePos);

                detected = FaceRecognition.Recognize(faceImage);

                SecurityStateManager.AddToHistory(username.Equals(detected));

                checkBlink(faceImage);
            }

            imageBox.Image = currentFrame;
        }
Пример #2
0
        public SecurityForm()
        {
            InitializeComponent();

            username = Authorization.username;

            capture = new Capture();
            CameraCapture.Init(capture);
            BlinkDetector.Init(new CascadeClassifier(eyePairClassifier), new CascadeClassifier(eyeClassifier));
            FaceDetection.Init(new CascadeClassifier(faceClassifier));
            SecurityStateManager.Clear();
            BlinkStateManager.Clear();

            labelInstruction.Text = "We will now capture a few images \nof your face";

            CameraCapture.Start();

            timer          = new DispatcherTimer();
            timer.Tick    += ProcessSecurityFrame;
            timer.Interval = new TimeSpan(0, 0, 0, 0, 1);
            timer.Start();
        }