Ejemplo n.º 1
0
        protected virtual void Process(DPFP.Sample Sample)
        {
            DrawPicture(FingerprintUtility.ConvertSampleToBitmap(Sample));

            //try
            //{
            DPFP.FeatureSet features = FingerprintUtility.ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification);
            SetPanelColor(System.Drawing.SystemColors.Control);
            SetPrompt("Verifying...");
            if (features != null)
            {
                // Compare the feature set with our template
                bool verified = false;
                foreach (DPFP.Template template in this.Samples.Keys)
                {
                    DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
                    Verificator.Verify(features, template, ref result);
                    if (result.Verified)
                    {
                        /* this.VerifiedObject = Samples[template];
                         * verified = true;
                         * SetPrompt("Verified.");
                         * Stop();*/
                        this.VerifiedObject = Samples[template];
                        //
                        int value = 0;
                        //get employeeID --> value from template fingerprint
                        bool hasValue = Samples.TryGetValue(template, out value);
                        if (hasValue)
                        {
                            Model.employeeNo = value.ToString();
                        }
                        // MessageBox.Show("EmployeeID: " + Model.employeeNo);
                        insertAttendanceTimeIn(Model.employeeNo);
                        verified = true;
                        SetPrompt("Verified.");

                        //Stop();
                    }
                }
                this.IsVerificationComplete = verified;
                if (!verified)
                {
                    SetPrompt("Finger print not recognised.");
                }
            }
            else
            {
                SetPrompt("Can't recognize as a fingerprint.");
            }
            //}
            //catch (Exception)
            //{
            //    SetPrompt("Error!");
            //}
        }
Ejemplo n.º 2
0
        protected virtual void Process(DPFP.Sample Sample)
        {
            DrawPicture(FingerprintUtility.ConvertSampleToBitmap(Sample));
            try
            {
                DPFP.FeatureSet features = FingerprintUtility.ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Enrollment);
                if (features != null)
                {
                    try
                    {
                        SetPrompt("The fingerprint feature set was created.");
                        SetPanelColor(System.Drawing.SystemColors.Control);
                        Enroller.AddFeatures(features);         // Add feature set to template.
                    }
                    catch (SDKException ex)
                    {
                        SetPrompt(ex.Message);
                    }
                    finally
                    {
                        UpdateSamplesNeeded();

                        // Check if template has been created.
                        switch (Enroller.TemplateStatus)
                        {
                        case DPFP.Processing.Enrollment.Status.Ready:           // report success and stop capturing
                            OnTemplateCollect(Enroller.Template);

                            SetPrompt("Done.");
                            Stop();
                            break;

                        case DPFP.Processing.Enrollment.Status.Failed:          // report failure and restart capturing
                            MessageBox.Show("Enrolment failed. Try again.");
                            Enroller.Clear();
                            Stop();

                            UpdateSamplesNeeded();
                            OnTemplateCollect(null);
                            Start();
                            break;
                        }
                    }
                }
                else
                {
                    SetPrompt("Can't recognize as a fingerprint.");
                    UpdateSamplesNeeded();
                }
            }
            catch (Exception)
            {
                SetPrompt("Can't recognize as a fingerprint.");
                UpdateSamplesNeeded();
            }
        }