Beispiel #1
0
        protected void Process(DPFP.Sample Sample)
        {
            ProcesarMuestra(Sample);

            // Este método es usado por el SDK para ir generando una plantilla completa, a partir de las 4 muestras que
            // pide, y va obteniendo sus "features"
            DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Enrollment);
            // Se verifica que la calidad de la muestra sea buena
            if (features != null)
            {
                try
                {
                    MakeReport("The fingerprint feature set was created.");
                    Enroller.AddFeatures(features);             // Add feature set to template.
                    pbMuestras.Invoke(new MethodInvoker(delegate { pbMuestras.Value += 25; }));
                    success = true;
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Ocurrió un error inesperado, por favor vuelva a intentarlo.", "Error Inesperado", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    // lblEstatus.Invoke(new MethodInvoker(delegate { lblEstatus.Text = "Error, vuelva a escanear"; }));
                    success = false;
                    pbMuestras.Invoke(new MethodInvoker(delegate { pbMuestras.Value = 0; }));
                    return;
                }
            }
Beispiel #2
0
        public void Process(DPFP.Sample Sample)
        {
            capturador.Process(Sample);

            DPFP.FeatureSet features = capturador.ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Enrollment);

            if (features != null)
            {
                try
                {
                    Enroller.AddFeatures(features);             // Add feature set to template.
                }
                finally
                {
                    // Check if template has been created.
                    switch (Enroller.TemplateStatus)
                    {
                    case DPFP.Processing.Enrollment.Status.Ready:       // report success and stop capturing
                        OnTemplate(Enroller.Template);
                        //SetPrompt("Click Close, and then click Fingerprint Verification.");
                        capturador.deter_captura();
                        break;

                    case DPFP.Processing.Enrollment.Status.Failed:      // report failure and restart capturing
                        Enroller.Clear();
                        capturador.deter_captura();
                        UpdateStatus();
                        OnTemplate(null);
                        capturador.iniciar_captura();
                        break;
                    }
                }
            }
        }
Beispiel #3
0
        protected override void Process(Sample Sample)
        {
            base.Process(Sample);
            DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Enrollment);
            if (features != null)
            {
                try
                {
                    MakeReport("The fingerprint featureset was created");
                    Enroller.AddFeatures(features);
                }
                finally
                {
                    UpdateStatus();
                    switch (Enroller.TemplateStatus)
                    {
                    case DPFP.Processing.Enrollment.Status.Ready:     //report success and stop capturing
                        OnTemplate(Enroller.Template);
                        SetPrompt("Click close, and then click fingerprint verification");
                        Stop();
                        break;

                    case DPFP.Processing.Enrollment.Status.Failed:
                        Enroller.Clear();
                        Stop();
                        UpdateStatus();
                        OnTemplate(null);
                        Start();
                        break;
                    }
                }
            }
        }
        protected override void Process(DPFP.Sample Sample)
        {
            base.Process(Sample);


            DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Enrollment);

            if (features != null)
            {
                try
                {
                    Enroller.AddFeatures(features);
                }
                finally
                {
                    switch (Enroller.TemplateStatus)
                    {
                    case DPFP.Processing.Enrollment.Status.Ready:
                        OnTemplate(Enroller.Template);

                        Stop();
                        break;

                    case DPFP.Processing.Enrollment.Status.Failed:
                        Enroller.Clear();
                        Stop();

                        OnTemplate(null);
                        Start();
                        break;
                    }
                }
            }
        }
        void DPFP.Capture.EventHandler.OnComplete(object capture, string readerSerialNumber, Sample sample)
        {
            DelegadoEstado delegado = new DelegadoEstado(this.Estado);

            DPFP.Capture.SampleConversion convertor = new DPFP.Capture.SampleConversion();

            Bitmap bitmap = null;

            convertor.ConvertToPicture(sample, ref bitmap);

            DPFP.Processing.FeatureExtraction Extractor = new DPFP.Processing.FeatureExtraction();

            DPFP.Capture.CaptureFeedback feedback = DPFP.Capture.CaptureFeedback.None;

            DPFP.FeatureSet feature = new DPFP.FeatureSet();

            Extractor.CreateFeatureSet(sample, DPFP.Processing.DataPurpose.Enrollment, ref feedback, ref feature);

            if (feedback == DPFP.Capture.CaptureFeedback.Good)
            {
                enroller.AddFeatures(feature);

                switch (enroller.TemplateStatus)
                {
                case DPFP.Processing.Enrollment.Status.Failed:
                {
                    this.Dispatcher.Invoke(delegado, "La captura de la huella no fue correcta.\nPor favor reintente", "error", bitmap);

                    break;
                }

                case DPFP.Processing.Enrollment.Status.Insufficient:
                {
                    this.Dispatcher.Invoke(delegado, "La captura de la huella fue correcta.\nPor favor repita la lectura", "acierto", bitmap);

                    break;
                }

                case DPFP.Processing.Enrollment.Status.Ready:
                {
                    this.Dispatcher.Invoke(delegado, "La captura de la huella fue correcta.\nPor favor grabe la lectura realizada", "valido", bitmap);

                    break;
                }

                default:
                {
                    this.Dispatcher.Invoke(delegado, "La captura de la huella no fue correcta.\nPor favor reintente", "error", bitmap);

                    break;
                }
                }
            }
            else
            {
                this.Dispatcher.Invoke(delegado, "La captura de la huella no fue correcta.\n Por favor reintente", bitmap);
            }
        }
        protected virtual void Process(Sample sample)
        {
            // Draw fingerprint sample image.
            DrawPicture(ConvertSampleToBitmap(sample));

            // Process the sample and create a feature set for the enrollment purpose.
            var features = ExtractFeatures(sample, DPFP.Processing.DataPurpose.Enrollment);

            // Check quality of the sample and add to enroller if it's good
            if (features != null)
            {
                try
                {
                    MakeReport("The fingerprint feature set was created.");
                    _enroller.AddFeatures(features);            // Add feature set to template.
                }
                finally
                {
                    UpdateStatus();

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

                        _btnFingerClicked.BackColor = Color.Green;
                        #region Capture Templates Here

                        var fingerprintData = new MemoryStream();
                        var templateCreated = _enroller.Template;
                        templateCreated.Serialize(fingerprintData);
                        Utils.CapturedTemplates[_enrollFinger - 1] = _enroller.Template;
                        _totalFingerEnrolled++;
                        // Add the created template to List of Templates that is going to Database
                        //Utils.BeneficiaryRegObj.FingerPrintTemplate.Add(fingerprintData.ToArray());



                        #endregion


                        //OnTemplate(_enroller.Template);
                        //SetPrompt("Click Close, and then click Fingerprint Verification.");
                        Stop();
                        break;

                    case DPFP.Processing.Enrollment.Status.Failed:      // report failure and restart capturing
                        _enroller.Clear();
                        Stop();
                        UpdateStatus();
                        //OnTemplate(null);
                        Start();
                        break;
                    }
                }
            }
        }
Beispiel #7
0
        protected override void Process(DPFP.Sample Sample)
        {
            base.Process(Sample);

            // Process the sample and create a feature set for the enrollment purpose.
            DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification);

            // Check quality of the sample and start verification if it's good
            // TODO: move to a separate task
            if (features != null)
            {
                DbConnection.checkConnection();
                lst = getbyet();
                DPFP.FeatureSet featur;
                for (int i = 0; i < lst.Count; i++)
                {
                    Stream      s      = new MemoryStream(lst[i].Prints);
                    DPFP.Sample sample = new DPFP.Sample(s);
                    featur = ExtractFeatures(sample, DPFP.Processing.DataPurpose.Enrollment);
                    enrol.AddFeatures(featur);
                    if (enrol.TemplateStatus == DPFP.Processing.Enrollment.Status.Ready)
                    {
                        // Compare the feature set with our template
                        DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
                        Verificator.Verify(features, enrol.Template, ref result);
                        UpdateStatus(result.FARAchieved);
                        if (result.Verified)
                        {
                            cnic = lst[i].CNIC;
                            this.DialogResult = System.Windows.Forms.DialogResult.OK;
                            base.Stop();
                            this.Dispose();
                            break;
                        }
                        else
                        {
                            cnic = "";
                            MakeReport("The fingerprint was NOT VERIFIED.");
                            enrol.Clear();
                        }
                    }
                }
            }
        }
Beispiel #8
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();
            }
        }
Beispiel #9
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("Intento realizado.");
                        SetPanelColor(Color.FromArgb(64, 69, 76));
                        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("Terminado.");
                            Stop();
                            break;

                        case DPFP.Processing.Enrollment.Status.Failed:          // report failure and restart capturing
                            Enroller.Clear();
                            Stop();
                            UpdateSamplesNeeded();
                            OnTemplateCollect(null);
                            Start();
                            break;
                        }
                    }
                }
                else
                {
                    SetPrompt("Sin detectar huella.");
                    UpdateSamplesNeeded();
                }
            }
            catch (Exception)
            {
                SetPrompt("Sin detectar huella.");
                UpdateSamplesNeeded();
            }
        }
Beispiel #10
0
        protected void Process(DPFP.Sample Sample)
        {
            MemSample = Sample;
            // Draw fingerprint sample image.
            DrawPicture(ConvertSampleToBitmap(Sample));

            DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Enrollment);
            // Check quality of the sample and add to enroller if it's good
            if (features != null)
            {
                try
                {
                    MakeReport("The fingerprint feature set was created.");
                    Enroller.AddFeatures(features);             // Add feature set to template.
                }
                finally
                {
                    //UpdateStatus();

                    // Check if template has been created.
                    switch (Enroller.TemplateStatus)
                    {
                    case DPFP.Processing.Enrollment.Status.Ready:       // report success and stop capturing
                        MemTemplate = Enroller.Template;
                        EnabledDisabledButton(true);
                        //OnTemplate(Enroller.Template);
                        //SetPrompt("Click Close, and then click Fingerprint Verification.");
                        //Stop();
                        break;

                    case DPFP.Processing.Enrollment.Status.Failed:      // report failure and restart capturing

                        SetStatus(string.Format("Faltan {0} Muestras!", Enroller.FeaturesNeeded));
                        Enroller.Clear();
                        MemTemplate = null;
                        EnabledDisabledButton(false);
                        //Stop();
                        //UpdateStatus();
                        //OnTemplate(null);
                        //Start();
                        break;

                    case DPFP.Processing.Enrollment.Status.Insufficient:
                        SetStatus(string.Format("Faltan {0} Muestras!", Enroller.FeaturesNeeded));
                        EnabledDisabledButton(false);
                        break;
                    }
                }
            }
        }
Beispiel #11
0
        protected virtual void Process(DPFP.Sample Sample /*, DPFP.Processing.DataPurpose Purpose*/)
        {
            DrawPicture(FingerPrintUtility.ConvertSampleToBitmap(Sample));
            try
            {
                DPFP.FeatureSet features = FingerPrintUtility.ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Enrollment);

                if (features != null)
                {
                    try
                    {
                        Enroller.AddFeatures(features);
                    }
                    catch
                    {
                        MessageBox.Show("Template error");
                    }
                    finally
                    {
                        UpdateSamplesNeeded();
                        switch (Enroller.TemplateStatus)
                        {
                        case DPFP.Processing.Enrollment.Status.Ready:
                            OnTemplateCollect(Enroller.Template);
                            Stop();
                            MessageBox.Show("Enrolled Successfuly");
                            break;

                        case DPFP.Processing.Enrollment.Status.Failed:
                            Enroller.Clear();
                            Stop();
                            OnTemplateCollect(null);
                            UpdateSamplesNeeded();
                            Start();
                            MessageBox.Show("Enroller Failed");
                            break;
                        }
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Cant recognize as a fingerprint.");
                UpdateSamplesNeeded();
            }
        }
Beispiel #12
0
        /// <summary>
        /// Se crea metodo para enviar el proceso de detectar el finger print
        /// </summary>
        /// <param name="Sample"></param>
        public async Task ProcessAsync(DPFP.Sample Sample)
        {
            //Process(Sample);

            // Process the sample and create a feature set for the enrollment purpose.
            DPFP.FeatureSet features = serv.ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Enrollment);

            // Check quality of the sample and add to enroller if it's good
            if (features != null)
            {
                try
                {
                    MakeReport("The fingerprint feature set was created.");
                    Enroller.AddFeatures(features);     // Add feature set to template.
                }
                finally
                {
                    UpdateStatus();

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

                        OnTemplate(Enroller.Template);
                        //Register64 = Convert.ToBase64String(Enroller.Template.Bytes);
                        SetPrompt("Click Close, and then click Fingerprint Verification.");
                        GuardarRegistroAsync();
                        Stop();
                        CrearCuenta();
                        trTimer.Enabled = true;
                        sqlin.HabilitarBiometricoNO();
                        //Enroller.Clear();
                        break;

                    case DPFP.Processing.Enrollment.Status.Failed:      // report failure and restart capturing
                        Enroller.Clear();
                        Stop();
                        UpdateStatus();
                        OnTemplate(null);
                        Start();
                        break;
                    }
                }
            }
        }
        protected void Process(DPFP.Sample Sample)
        {
            try
            {
                this.Processos(Sample);

                // Process the sample and create a feature set for the enrollment purpose.
                DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Enrollment);

                // Check quality of the sample and add to enroller if it's good
                if (features != null)
                {
                    try
                    {
                        // MakeReport("The fingerprint feature set was created.");
                        Enroller.AddFeatures(features);         // Add feature set to template.
                    }
                    finally
                    {
                        UpdateStatus();
                        // Check if template has been created.
                        switch (Enroller.TemplateStatus)
                        {
                        case DPFP.Processing.Enrollment.Status.Ready:           // report success and stop capturing
                            SetPrompt("Click Close, and then click Fingerprint Verification.");
                            bandera = "ok";
                            Stop();

                            break;

                        case DPFP.Processing.Enrollment.Status.Failed:          // report failure and restart capturing
                            Enroller.Clear();
                            Stop();
                            UpdateStatus();
                            Start();
                            break;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Las huellas no coinciden");
            }
        }
 public void enroll(DPFP.Sample Sample)
 {
     DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Enrollment);
     if (features != null)
     {
         Enroller.AddFeatures(features);     // Add feature set to template.
         if (Enroller.TemplateStatus == DPFP.Processing.Enrollment.Status.Ready)
         {
             Enroller.Template.Serialize(ref template);
             runQuery(template);
             hideForm();
         }
         else
         {
             updateLabel("Lift Finger to Scan again");
         }
     }
 }
        protected override void Process(DPFP.Sample Sample)
        {
            base.Process(Sample);

            // Process the sample and create a feature set for the enrollment purpose.
            DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Enrollment);

            // Check quality of the sample and add to enroller if it's good
            if (features != null)
            {
                try
                {
                    MakeReport("The fingerprint feature set was created.");
                    Enroller.AddFeatures(features);     // Add feature set to template.
                }
                finally
                {
                    UpdateStatus();

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

                        if (OnTemplate != null)
                        {
                            OnTemplate(Enroller.Template);
                        }

                        SetPrompt("Click Close, and then click Fingerprint Verification.");
                        Stop();
                        break;

                    case DPFP.Processing.Enrollment.Status.Failed:      // report failure and restart capturing
                        Enroller.Clear();
                        Stop();
                        UpdateStatus();
                        OnTemplate(null);
                        Start();
                        break;
                    }
                }
            }
        }
Beispiel #16
0
        private void Procces(DPFP.Sample Sample)
        {
            Bitmap BMP = ConvertSampleTobitmap(Sample);

            DrawPicture(BMP);
            DPFP.FeatureSet Features = ExtractFeaTures(Sample, DPFP.Processing.DataPurpose.Enrollment);
            if (Features != null)
            {
                try
                {
                    Enroller.AddFeatures(Features);
                }
                catch
                {
                    MessageBox.Show("Error de guardado");
                    Enroller.Clear();
                    Stop();
                    ActualizarStado();
                    OnTemplate(null);
                    Start();
                }
                finally
                {
                    ActualizarStado();
                    switch (Enroller.TemplateStatus)
                    {
                    case DPFP.Processing.Enrollment.Status.Ready:
                        OnTemplate(Enroller.Template);
                        //Anunciar("Dedo guardado");
                        //MessageBox.Show("Dedo Guardado");
                        Stop();
                        break;

                    case DPFP.Processing.Enrollment.Status.Failed:
                        Enroller.Clear();
                        Stop();
                        ActualizarStado();
                        OnTemplate(null);
                        Start();
                        break;
                    }
                }
            }
        }
        protected virtual void Process(DPFP.Sample Sample)
        {
            // draw fingerprint sample image.
            DrawPicture(ConvertSampleToBitmap(Sample));
            DPFP.FeatureSet features             = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Enrollment);
            DPFP.Capture.SampleConversion ToByte = new DPFP.Capture.SampleConversion();


            // Check quality of the sample and add to enroller if it's good
            if (features != null)
            {
                try
                {
                    MakeReport("The fingerprint feature set was created.");
                    Enroller.AddFeatures(features);
                }
                finally
                {
                    UpdateStatus();


                    switch (Enroller.TemplateStatus)
                    {
                    case DPFP.Processing.Enrollment.Status.Ready:               // report success and stop capturing
                        //OnTemplate(Enroller.Template);

                        SetPrompt("Done.");


                        cp.StopCapture();
                        break;

                    case DPFP.Processing.Enrollment.Status.Failed:              // report failure and restart capturing
                        Enroller.Clear();
                        cp.StopCapture();
                        UpdateStatus();
                        // OnTemplate(null);
                        cp.StartCapture();
                        break;
                    }
                }
            }
        }
Beispiel #18
0
        private void EnrollFingerFeatureSet(Sample Sample)
        {
            //create enrollment instance
            FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Enrollment);

            if (features != null)
            {
                try
                {
                    Dispatcher.BeginInvoke(new Action(() =>
                    {
                        textBlock.Text = "The Fingerprint Features Was Successfully Extracted.";
                    }));

                    Enroller.AddFeatures(features);             // Add feature set to template.
                }
                finally
                {
                    switch (Enroller.TemplateStatus)
                    {
                    case DPFP.Processing.Enrollment.Status.Ready:       // report success and stop capturing

                        CreateFinalTemplate(Enroller.Template);
                        Dispatcher.BeginInvoke(new Action(() =>
                        {
                            textBlock_status.Text = Enroller.TemplateStatus.ToString() + ": Click the Enroll Button to Save";
                        }));

                        break;

                    case DPFP.Processing.Enrollment.Status.Failed:      // report failure and restart capturing

                        CreateFinalTemplate(null);
                        Enroller.Clear();
                        Dispatcher.BeginInvoke(new Action(() =>
                        {
                            textBlock_status.Text = Enroller.TemplateStatus.ToString();
                        }));
                        break;
                    }
                }
            }
        }
Beispiel #19
0
        /// <summary>
        /// Ejecuta el proceso de incripcion de la huella
        /// </summary>
        /// <param name="Sample"></param>
        private string Process(DPFP.Sample Sample)
        {
            string state = "";

            DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Enrollment);
            // Check quality of the sample and add to enroller if it's good
            if (features != null)
            {
                try
                {
                    Enroller.AddFeatures(features);     // Add feature set to template.
                    state = "procces";
                } catch (DPFP.Error.SDKException e) {
                    Enroller.Clear();
                    this.Pause();
                    Start();

                    return(state = "failed");
                }
            }
        protected void ProcessEnrol(DPFP.Sample Sample)
        {
            // Draw fingerprint sample image.
            DrawPicture(ConvertSampleToBitmap(Sample));

            // Process the sample and create a feature set for the enrollment purpose.
            DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Enrollment);

            // Check quality of the sample and add to enroller if it's good
            if (features != null)
            {
                try
                {
                    MakeReport("The fingerprint feature set was created.");
                    Enroller.AddFeatures(features);                         // Add feature set to template.
                }
                finally
                {
                    UpdateStatus();

                    // Check if template has been created.
                    switch (Enroller.TemplateStatus)
                    {
                    case DPFP.Processing.Enrollment.Status.Ready:                               // report success and stop capturing
                        OnTemplate(Enroller.Template);
                        SetPrompt("Fingerprint registration was successful.");

                        Stop();
                        break;

                    case DPFP.Processing.Enrollment.Status.Failed:                              // report failure and restart capturing
                        Enroller.Clear();
                        Stop();
                        UpdateStatus();
                        OnTemplate(null);
                        Start();
                        break;
                    }
                }
            }
        }
Beispiel #21
0
        protected void Process(DPFP.Sample Sample)
        {
            DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Enrollment);

            if (features != null)
            {
                try
                {
                    SetPrompt("Отпечаток получен. Повторите сканирование (до 4 раз).");
                    Enroller.AddFeatures(features);
                    counter++;
                    PB1.Image = new Bitmap(ConvertSampleToBitmap(Sample), PB1.Size);
                }
                finally
                {
                    switch (Enroller.TemplateStatus)
                    {
                    case DPFP.Processing.Enrollment.Status.Ready:
                        SetPrompt("Процесс сканирования завершен.");
                        Stop();
                        byte[] btarr = null;
                        Enroller.Template.Serialize(ref btarr);

                        insertIntoDB(btarr, fn, eid, mid);

                        //Application.Current.Properties.Add("template", Enroller.Template);

                        break;

                    case DPFP.Processing.Enrollment.Status.Failed:
                        Enroller.Clear();
                        Stop();
                        OnTemplate(null);
                        Start();
                        break;
                    }
                }
            }
        }
Beispiel #22
0
        protected void Process(DPFP.Sample Sample)
        {
            MemSample = Sample;

            //SearchUserByFingerprint(MemSample);
            DrawPicture(ConvertSampleToBitmap(Sample));
            DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Enrollment);

            if (features != null)
            {
                try
                {
                    MakeReport("Fingerprint sample collected.");
                    Enroller.AddFeatures(features);
                }
                finally
                {
                    switch (Enroller.TemplateStatus)
                    {
                    case DPFP.Processing.Enrollment.Status.Ready:
                        MemTemplate = Enroller.Template;
                        EnabledDisabledButton(true);
                        break;

                    case DPFP.Processing.Enrollment.Status.Failed:
                        SetStatus(string.Format("{0} samples left!", Enroller.FeaturesNeeded));
                        Enroller.Clear();
                        MemTemplate = null;
                        EnabledDisabledButton(false);
                        break;

                    case DPFP.Processing.Enrollment.Status.Insufficient:
                        SetStatus(string.Format("{0} samples left!", Enroller.FeaturesNeeded));
                        EnabledDisabledButton(false);
                        break;
                    }
                }
            }
        }
        protected void Procesar(DPFP.Sample Sample)
        {
            DPFP.FeatureSet caracteristicas = extraercaracteristicas(Sample, DPFP.Processing.DataPurpose.Enrollment);
            if ((caracteristicas != null))
            {
                try
                {
                    Enroller.AddFeatures(caracteristicas);
                }
                finally
                {
                    StringBuilder text = new StringBuilder();
                    text.AppendFormat("Necesitas pasar el dedo {0} veces", Enroller.FeaturesNeeded);
                    mostrarveces(text.ToString());
                    switch (Enroller.TemplateStatus)
                    {
                    case DPFP.Processing.Enrollment.Status.Ready:
                    {
                        template = Enroller.Template;
                        PararCpatura();
                        this.Dispatcher.BeginInvoke((Action)(() => { btonguardar.IsEnabled = true; }));
                        this.Dispatcher.BeginInvoke((Action)(() => { btonguardar.Visibility = Visibility.Visible; }));
                        //btonguardar.IsEnabled = true;
                        break;
                    }

                    case DPFP.Processing.Enrollment.Status.Failed:
                    {
                        Enroller.Clear();
                        PararCpatura();
                        IniciarCaptura();
                        break;
                    }
                    }
                }
            }
        }
Beispiel #24
0
        public void SetFeaturesEnrollment(DPFP.Sample sample)
        {
            DPFP.FeatureSet featureSet = CreateFeatureSet(sample, DPFP.Processing.DataPurpose.Enrollment);
            if (featureSet != null)
            {
                try
                {
                    enrollment.AddFeatures(featureSet);
                }
                catch (Exception e)
                {
                    MessageBox.Show("ERROR AL EXTRAER LAS CARACTERISTICAS DE LA HUELLA");
                }
                finally
                {
                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.AppendFormat("Necesitas pasar el dedo {0} veces", enrollment.FeaturesNeeded);
                    SetLabelCount(stringBuilder.ToString());

                    switch (enrollment.TemplateStatus)
                    {
                    case DPFP.Processing.Enrollment.Status.Ready:
                        template = enrollment.Template;
                        EnableButtonSave();
                        StopCapture();
                        break;

                    case DPFP.Processing.Enrollment.Status.Failed:
                        enrollment.Clear();
                        StopCapture();
                        InitCapture();
                        break;
                    }
                }
            }
        }
        public void SetFeaturesEnrollment(DPFP.Sample sample)
        {
            DPFP.FeatureSet featureSet = CreateFeatureSet(sample, DPFP.Processing.DataPurpose.Enrollment);
            if (featureSet != null)
            {
                try
                {
                    enrollment.AddFeatures(featureSet);
                }
                catch (Exception e)
                {
                    MessageBox.Show("ERROR WHEN EXTRACTING THE FEATURES OF THE PRINT");
                }
                finally
                {
                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.AppendFormat("You need to swipe {0} times", enrollment.FeaturesNeeded);
                    SetLabelCount(stringBuilder.ToString());

                    switch (enrollment.TemplateStatus)
                    {
                    case DPFP.Processing.Enrollment.Status.Ready:
                        template = enrollment.Template;
                        EnableButtonSave();
                        StopCapture();
                        break;

                    case DPFP.Processing.Enrollment.Status.Failed:
                        enrollment.Clear();
                        StopCapture();
                        InitCapture();
                        break;
                    }
                }
            }
        }
Beispiel #26
0
        public void OnComplete(object obj, string info, DPFP.Sample sample)
        {
            this.Invoke(new Functionz(delegate()
            {
                textBox1.Text = "Captura Completa";
            }));
            this.Invoke(new Functionz(delegate()
            {
                Bitmap tempRef = null;
                converter.ConvertToPicture(sample, ref tempRef);
                System.Drawing.Image img = tempRef;

                Bitmap bmp = new Bitmap(converter.ConvertToPicture(sample, ref
                                                                   tempRef), pbImage.Size);
                String pxFormat = bmp.PixelFormat.ToString();
                Point txtLoc    = new Point(pbImage.Width / 2 - 20, 0);
                graphics        = Graphics.FromImage(bmp);

                if (registrationInProgress)
                {
                    try
                    {
                        regFeatures[0] = ExtractFeatures(sample,
                                                         DPFP.Processing.DataPurpose.Enrollment);
                        regFeatures[1] = ExtractFeatures(sample,
                                                         DPFP.Processing.DataPurpose.Enrollment);
                        regFeatures[2] = ExtractFeatures(sample,
                                                         DPFP.Processing.DataPurpose.Enrollment);
                        regFeatures[3] = ExtractFeatures(sample,
                                                         DPFP.Processing.DataPurpose.Enrollment);
                        if (regFeatures[0] != null)
                        {
                            string b64 =
                                Convert.ToBase64String(regFeatures[0].Bytes);

                            regFeatures[0].DeSerialize(Convert.FromBase64String(b64));
                            if (regFeatures[0] == null)
                            {
                                txtLoc.X = pbImage.Width / 2 - 26;
                                graphics.DrawString("Error", font, Brushes.Cyan,
                                                    txtLoc);
                                return;
                            }
                            createRegTemplate.AddFeatures(regFeatures[0]);
                            createRegTemplate.AddFeatures(regFeatures[1]);
                            createRegTemplate.AddFeatures(regFeatures[2]);
                            createRegTemplate.AddFeatures(regFeatures[3]);
                            graphics = Graphics.FromImage(bmp);
                            graphics.DrawString("" + 0 + " De 4", font,
                                                Brushes.Black, txtLoc);
                            if (createRegTemplate.TemplateStatus ==
                                DPFP.Processing.Enrollment.Status.Failed)
                            {
                                capturer.StopCapture();
                                MessageBox.Show("Error en la captura");
                            }
                            else
                            if (createRegTemplate.TemplateStatus ==
                                DPFP.Processing.Enrollment.Status.Ready)
                            {
                                string mensaje   = "";
                                MemoryStream x   = new MemoryStream();
                                MemoryStream mem = new MemoryStream();
                                template         = createRegTemplate.Template;
                                template.Serialize(mem);
                                verFeatures = ExtractFeatures(sample,
                                                              DPFP.Processing.DataPurpose.Verification);
                                mensaje = comparar(verFeatures);
                                if (mensaje == "Huella registrada")
                                {
                                    MessageBox.Show(mensaje, "Información",
                                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                }
                                else
                                {
                                    textBox1.Text = "";
                                    MessageBox.Show("Huella no registrada",
                                                    "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                }
                            }
                        }
                    }
                    catch (DPFP.Error.SDKException ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
                pbImage.Image = bmp;
            }));
        }
        protected override void Process(DPFP.Sample Sample)
        {
            try
            {
                base.Process(Sample);
                Stop();

                // Process the sample and create a feature set for the enrollment purpose.
                DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Enrollment);

                // Check quality of the sample and add to enroller if it's good
                if (features != null)
                {
                    //Check if finger is already enrolled
                    IsFingerEnrolled = ValidateFinger(Sample, features);
                    //Check user try to enroll duplicate finger at one transaction.

                    if (!IsFingerEnrolled)
                    {
                        Verificator = new DPFP.Verification.Verification();

                        features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Enrollment);

                        try
                        {
                            Enroller.AddFeatures(features);     // Add feature set to template.
                            Completion += 25;

                            Status       = "Great. Now repeat.";
                            Instruction  = "Move your finger slightly to add all different parts of your fingerprint.";
                            Notification = "Lift finger, then touch the sensor again. Completion - " + Completion + "%.";
                        }
                        finally
                        {
                            //UpdateStatus();

                            // Check if template has been created.
                            switch (Enroller.TemplateStatus)
                            {
                            case DPFP.Processing.Enrollment.Status.Ready:       // report success and stop capturing
                                OnTemplate(Enroller.Template);
                                Stop();
                                Status      = "Fingerprint enrolled.";
                                Instruction = "Fingerprint enrollment completed succesfully. You may close this window.";
                                IsDone      = true;
                                break;

                            case DPFP.Processing.Enrollment.Status.Failed:      // report failure and restart capturing
                                Enroller.Clear();
                                Stop();
                                OnTemplate(null);

                                Status      = "Fingerprint not enrolled.";
                                Instruction = "Fingerprint enrollment not completed succesfully. Please try again.";

                                Notification = "Put your finger on the sensor again and lift after you see next instruction.";
                                Instruction  = "";
                                Completion   = 0;

                                Start();
                                break;
                            }
                        }
                    }
                    else
                    {
                        SwitchOff();
                        Status = "Fingerprint has been enrolled, try again.";
                        Start();
                    }
                }
            }

            catch (Exception error)
            {
                Logger.Error(error);
                Status = "Failed to process fingerprint, try again.";
            }

            Start();
        }
Beispiel #28
0
        public void ProcesarPersonal(DPFP.Sample Sample)
        {
            try
            {
                bool banRegistrado = true;
                DrawPicturePersonal(ConvertSampleToBitmapPersonal(Sample));
                DPFP.FeatureSet features = ExtractFeaturesPersonal(Sample, DPFP.Processing.DataPurpose.Enrollment);
                if (features != null)
                {
                    try
                    {
                        Enroller.AddFeatures(features);
                    }
                    catch (Exception)
                    {
                        //LogError.AddExcFileTxt(ex, "LectorHuella ~ ProcesarPersonal");
                        this.FrmCapturaHuella.Invoke(new Function(delegate()
                        {
                            FrmCapturaHuella.lblInstrucciones.Text      = "Error al procesar las huellas.";
                            FrmCapturaHuella.lblInstrucciones.BackColor = Color.Red;
                        }));
                        Thread.Sleep(2400);
                    }
                }
                finally
                {
                    UpdateStatusPersonal();
                    switch (Enroller.TemplateStatus)
                    {
                    case DPFP.Processing.Enrollment.Status.Ready:
                        Template = Enroller.Template;
                        if (DatosHuellas == null)
                        {
                            Usuario_Negocio UN       = new Usuario_Negocio();
                            Usuario         DatosAux = new Usuario {
                                Conexion = Comun.Conexion
                            };
                            UN.ObtenerHuellasDigitales(DatosAux);
                            DatosHuellas = DatosAux.TablaDatos;
                        }
                        foreach (DataRow usuario in DatosHuellas.Rows)
                        {
                            DPFP.Template templateGuardado = new DPFP.Template();
                            templateGuardado.DeSerialize(ConvertirStringToBytes.StringToBytes(usuario["HuellaDigital"].ToString()));
                            if (procesarPersonal(Sample, templateGuardado))
                            {
                                banRegistrado = false;
                                break;
                            }
                        }
                        if (banRegistrado)
                        {
                            FrmCapturaHuella.Lector.Stop();
                            activaBtnPersonal();
                        }
                        else
                        {
                            Enroller.Clear();
                            FrmCapturaHuella.Lector.Stop();
                            FrmCapturaHuella.Invoke(new Function(delegate()
                            {
                                FrmCapturaHuella.lblInstrucciones.Text      = "La huella ya está registrada.";
                                FrmCapturaHuella.lblInstrucciones.BackColor = Color.Red;
                                //System.Windows.Forms.MessageBox.Show("La huella ya está registrada.", "Sistema Administrador CSL", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                                //FrmCapturaHuella.DialogResult = System.Windows.Forms.DialogResult.Abort;
                            }));
                            Thread.Sleep(2400);
                            Template = null;
                            FrmCapturaHuella.Lector = new LectorHuella();
                            FrmCapturaHuella.frmCatEmpleadoHuella_Load(new object(), new EventArgs());
                            UpdateStatusPersonal();
                        }
                        break;

                    case DPFP.Processing.Enrollment.Status.Failed:
                        Enroller.Clear();
                        FrmCapturaHuella.Lector.Stop();
                        UpdateStatusPersonal();
                        Template = null;
                        FrmCapturaHuella.Lector.Start();
                        break;
                    }
                }
            }
        protected override void Process(DPFP.Sample Sample)
        {
            base.Process(Sample);

            // Process the sample and create a feature set for the enrollment purpose.
            DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Enrollment);

            // Check quality of the sample and add to enroller if it's good
            if (features != null)
            {
                try
                {
                    MakeReport("The Fingerprint Feature Set was Created.");
                    Enroller.AddFeatures(features);
                }
                finally
                {
                    UpdateStatus();
                    // Check if template has been created.
                    switch (Enroller.TemplateStatus)
                    {
                    // report success and stop capturing
                    case DPFP.Processing.Enrollment.Status.Ready:
                        byte[]   serializedTemplate = null;
                        DateTime cur_date           = DateTime.Now;
                        Enroller.Template.Serialize(ref serializedTemplate);

                        if (serializedTemplate != null)
                        {
                            string result = Encoding.UTF8.GetString(serializedTemplate);
                            Console.Write(result);

                            if (txtMatric.Text != "" & txtName.Text != "" & txtLevel.Text != "" & txtDept.Text != "")
                            {
                                MySqlConnection cnn = new MySqlConnection();
                                //connection to database
                                cnn.ConnectionString = "Server=localhost;Database=fpExam;Uid=root;Pwd=;";;
                                cnn.Open();
                                MySqlCommand     cmd = new MySqlCommand();
                                MySqlDataAdapter adp = new MySqlDataAdapter("SELECT * FROM tbStudFP WHERE Matric_No='" + txtMatric.Text + "'", cnn);
                                DataTable        dt  = new DataTable();
                                adp.Fill(dt);
                                try
                                {
                                    string mat = dt.Columns[0].ToString();
                                    if (txtMatric.Text != mat)
                                    {
                                        cmd = cnn.CreateCommand();
                                        // Store Student Data and FpTemplate as byte
                                        cmd.CommandText = "INSERT INTO tbStudFP(Matric_No,Full_Name,Level,Department,FpTemplate) VALUES (@matric_no,@full_name,@level,@dept,@serializedTemplate)";
                                        cmd.Parameters.AddWithValue("@matric_no", txtMatric.Text);
                                        cmd.Parameters.AddWithValue("@full_name", txtName.Text);
                                        cmd.Parameters.AddWithValue("@level", txtLevel.Text);
                                        cmd.Parameters.AddWithValue("@dept", txtDept.Text);
                                        cmd.Parameters.AddWithValue("@serializedTemplate", serializedTemplate);
                                        cmd.ExecuteNonQuery();
                                    }
                                    else
                                    {
                                        MakeReport("Matric No: '" + txtMatric.Text + "' is already Registered");
                                    }
                                }
                                catch (Exception ex)
                                {
                                    throw ex;
                                }
                                finally
                                {
                                    cnn.Close();
                                }
                            }
                            else
                            {
                                SetPrompt("Please Enter all Fields");
                            }
                        }
                        OnTemplate(Enroller.Template);
                        SetPrompt("Fingerprint Enrolment was Successful.");
                        Stop();
                        break;

                    // report failure and restart capturing
                    case DPFP.Processing.Enrollment.Status.Failed:
                        Enroller.Clear();
                        Stop();
                        UpdateStatus();
                        OnTemplate(null);
                        Start();
                        break;
                    }
                }
            }
        }
        private void Parse(DPFP.Sample Sample)
        {
            //MessageBox.Show("OK");

            DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Enrollment);

            // Check quality of the sample and add to enroller if it's good
            if (features != null)
            {
                try
                {
                    try
                    {
                        Enroller.AddFeatures(features);         // Add feature set to template.
                    }
                    catch
                    {
                    }
                }
                finally
                {
                    UpdateStatus();
                    // Check if template has been created.
                    switch (Enroller.TemplateStatus)
                    {
                    case DPFP.Processing.Enrollment.Status.Ready:       // report success and stop capturing
                        Stop();
                        this.Dispatcher.Invoke(() =>
                        {
                            if (this.ClockHide != null)
                            {
                                this.ClockHide.Controller.Pause();
                            }
                            ColorAnimation animation = new ColorAnimation();
                            animation.From           = (this.UIStatus.Foreground as SolidColorBrush).Color;
                            animation.To             = Colors.Red;
                            animation.Duration       = new Duration(TimeSpan.FromMilliseconds(450));
                            animation.EasingFunction = new PowerEase()
                            {
                                Power = 5, EasingMode = EasingMode.EaseInOut
                            };
                            this.ClockShow = animation.CreateClock();
                            this.UIStatus.Foreground.ApplyAnimationClock(SolidColorBrush.ColorProperty, ClockShow);
                        });
                        if (OnTemplateEvent != null)
                        {
                            OnTemplateEvent(this, Enroller.Template);
                        }
                        break;

                    case DPFP.Processing.Enrollment.Status.Failed:      // report failure and restart capturing
                        Enroller.Clear();
                        Stop();
                        this.Dispatcher.Invoke(() =>
                        {
                            this.UITime.Text       = "Try again ...";
                            this.UITime.FontSize   = 15.333;
                            this.UITime.FontWeight = FontWeights.Normal;
                            this.UITime.Foreground = new SolidColorBrush(Colors.White);
                        });
                        Start();
                        break;
                    }
                }
            }
        }