Пример #1
1
        public static bool Verify(DPFP.Sample _sample, DPFP.Template _template)
        {
            try
            {
                bool _result = false;
                DPFP.Verification.Verification Verificator = new DPFP.Verification.Verification();
                DPFP.FeatureSet features = zsi.dtrs.Util.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)
                {
                    // Compare the feature set with our template
                    DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
                    Verificator.Verify(features, _template, ref result);

                    if (result.Verified)
                    {
                        _result = true;
                    }
                    else
                    {
                        _result = false;
                    }
                }
                return(_result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        protected void Process(DPFP.Sample Sample)
        {
            DrawPicture(ConvertSampleToBitmap(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)
            {
                // Compare the feature set with our tamplete
                DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
                verifor.Verify(features, tamplete, ref result);
                if (result.Verified)
                {
                    MakeReport("The fingerprint was VERIFIED.");
                    displayData(files[fileCounter - 1]);
                    fileCounter = 0;
                    isVarifed   = true;
                }
                else
                {
                    MakeReport("The fingerprint was NOT VERIFIED.");
                    Stop();
                    loadNextFile();
                    Init();
                    Start();
                }
            }
        }
Пример #3
0
        private void OnComplete(object Control, DPFP.FeatureSet FeatureSet, ref DPFP.Gui.EventHandlerStatus Status)
        {
            DPFP.Verification.Verification        ver = new DPFP.Verification.Verification();
            DPFP.Verification.Verification.Result res = new DPFP.Verification.Verification.Result();

            //save to the db
            const string filename = "biometricverification.sqlite";
            var          conn     = new SQLiteConnection("Data Source=" + filename + ";");

            try
            {
                conn.Open();
                using (var command = new SQLiteCommand("SELECT * FROM fingerprint WHERE fingerprint = @finger_print", conn))
                {
                    command.Parameters.Add("@finger_print", DbType.Binary).Value = FeatureSet.Bytes;
                    //command.Parameters.Add("@fingerD", DbType.Int16).Value = Finger;
                    SQLiteDataReader dataR = command.ExecuteReader();
                    if (dataR.HasRows)
                    {
                        verification_status_lbl.ForeColor = Color.Green;
                        verification_status_lbl.Text      = "VALID";
                    }
                    else
                    {
                        Status = DPFP.Gui.EventHandlerStatus.Failure;
                        verification_status_lbl.ForeColor = Color.Red;
                        verification_status_lbl.Text      = "INVALID";
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            // Compare feature set with all stored templates.
            //foreach (DPFP.Template template in Data.Templates)
            //{
            //    // Get template from storage.
            //    if (template != null)
            //    {
            //        // Compare feature set with particular template.
            //        ver.Verify(FeatureSet, template, ref res);
            //        Data.IsFeatureSetMatched = res.Verified;
            //        Data.FalseAcceptRate = res.FARAchieved;
            //        if (res.Verified)
            //            verification_status_lbl.ForeColor = Color.Green;
            //            verification_status_lbl.Text = "VALID";
            //            break; // success
            //    }
            //}
            //if (!res.Verified)
            //{
            //    Status = DPFP.Gui.EventHandlerStatus.Failure;
            //    verification_status_lbl.ForeColor = Color.Red;
            //    verification_status_lbl.Text = "INVALID";
            //}
            Thread.Sleep(TimeSpan.FromSeconds(3));
            verification_status_lbl.Text = "";
        }
Пример #4
0
 protected DPFP.FeatureSet ExtractFeatures(DPFP.Sample Sample, DPFP.Processing.DataPurpose Purpose)
 {
     DPFP.Processing.FeatureExtraction Extractor = new DPFP.Processing.FeatureExtraction();      // Create a feature extractor
     DPFP.Capture.CaptureFeedback      feedback  = DPFP.Capture.CaptureFeedback.None;
     DPFP.FeatureSet features = new DPFP.FeatureSet();
     Extractor.CreateFeatureSet(Sample, Purpose, ref feedback, ref features);                    // TODO: return features as a result?
     debugFeedback = feedback;
     if (feedback == DPFP.Capture.CaptureFeedback.Good)
     {
         notifyEvent = new FingerArgs(ReaderSerialNumber, FingerArgs.FingerNotify.RN_CaptureGood, "Capture is Good");
         if (NotifyEvent != null)
         {
             NotifyEvent(this, notifyEvent);
         }
         return(features);
     }
     else
     {
         notifyEvent = new FingerArgs(ReaderSerialNumber, FingerArgs.FingerNotify.RN_CaptureBad, feedback.ToString());
         if (NotifyEvent != null)
         {
             NotifyEvent(this, notifyEvent);
         }
         return(null);
     }
 }
Пример #5
0
 public void OnComplete(object Control, DPFP.FeatureSet FeatureSet, ref DPFP.Gui.EventHandlerStatus Status)
 {
     DPFP.Verification.Verification        ver = new DPFP.Verification.Verification();
     DPFP.Verification.Verification.Result res = new DPFP.Verification.Verification.Result();
     // Compare feature set with all stored templates.
     foreach (DPFP.Template template in Data.Templates)
     {
         // Get template from storage.
         if (template != null)
         {
             // Compare feature set with particular template.
             ver.Verify(FeatureSet, template, ref res);
             Data.IsFeatureSetMatched = res.Verified;
             Data.FalseAcceptRate     = res.FARAchieved;
             if (res.Verified)
             {
                 break; // success
             }
         }
     }
     if (!res.Verified)
     {
         Status = DPFP.Gui.EventHandlerStatus.Failure;
     }
     Data.Update();
 }
Пример #6
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;
                    }
                }
            }
        }
Пример #7
0
        public bool ProcesarChecado(DPFP.Sample Sample, DPFP.Template templateGuardado, frmChecarEntradaSalida FrmChecar)
        {
            try
            {
                DrawPictureChecar(ConvertSampleToBitmapLogin(Sample), FrmChecar);
                DPFP.FeatureSet features = ExtractFeaturesChecar(Sample, DPFP.Processing.DataPurpose.Verification);
                if (features != null)
                {
                    DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
                    Verificator.Verify(features, templateGuardado, ref result);

                    if (result.Verified)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                LogError.AddExcFileTxt(ex, "LectorHuella ~ ProcesarChecado");
                return(false);
            }
        }
Пример #8
0
 protected DPFP.FeatureSet ExtractFeatures(DPFP.Sample Sample,
                                           DPFP.Processing.DataPurpose Purpose)
 {
     DPFP.Processing.FeatureExtraction Extractor = new
                                                   DPFP.Processing.FeatureExtraction(); // Create a feature extractor
     DPFP.Capture.CaptureFeedback feedback =
         DPFP.Capture.CaptureFeedback.None;
     DPFP.FeatureSet features = new DPFP.FeatureSet();
     try
     {
         Extractor.CreateFeatureSet(Sample, Purpose, ref feedback, ref
                                    features);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     if (feedback == DPFP.Capture.CaptureFeedback.Good)
     {
         return(features);
     }
     else
     {
         return(null);
     }
 }
        private void verify(DPFP.Sample Sample)
        {
            DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification);

            byte[] fpbyte = getFTemplate();
            if (fpbyte != null)
            {
                Stream        stream = new MemoryStream(fpbyte);
                DPFP.Template tmpObj = new DPFP.Template(stream);


                DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
                // Compare the feature set with our template
                Verificator.Verify(features, tmpObj, ref result);
                if (result.Verified)
                {
                    MessageBox.Show("The fingerprint was VERIFIED.");
                    client.Send("desktop-verify-verified");
                }
                else
                {
                    MessageBox.Show("The fingerprint was NOT VERIFIED.");
                    client.Send("desktop-verify-notverified");
                }
            }


            hideForm();
        }
Пример #10
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)
            {
                // Compare the feature set with our template
                DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();

                DPFP.Template template = new DPFP.Template();
                Stream        stream;

                foreach (var emp in contexto.Empleadoes)
                {
                    stream   = new MemoryStream(emp.Huella);
                    template = new DPFP.Template(stream);

                    Verificator.Verify(features, template, ref result);
                    UpdateStatus(result.FARAchieved);
                    if (result.Verified)
                    {
                        MakeReport("The fingerprint was VERIFIED. " + emp.Nombre);
                        break;
                    }
                }
            }
        }
Пример #11
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)
            {
                // Compare the feature set with our template
                DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
                Verificator.Verify(features, Template, ref result);
                UpdateStatus(result.FARAchieved);
                if (result.Verified)
                {
                    MakeReport("The fingerprint was VERIFIED.");
                }
                else
                {
                    MakeReport("The fingerprint was NOT VERIFIED.");
                }
            }
        }
        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)
            {
                // Compare the feature set with our template
                DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
                Verificator.Verify(features, Template, ref result);
                UpdateStatus(result.FARAchieved);
                if (result.Verified)
                {
                    MakeReport("A impressão digital foi verificada.");
                    MetroFramework.MetroMessageBox.Show(this, "A impressão digital foi verificada com sucesso.", "Verificação biométrica", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Question);
                }
                else
                {
                    MakeReport("A impressão digital não foi verificada.");
                    MetroFramework.MetroMessageBox.Show(this, "A impressão digital não encontrada. Tente novamente.", "Verificação biométrica", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand);
                }
            }
        }
Пример #13
0
        protected virtual void Process(DPFP.Sample Sample)
        {
            DrawPicture(ConvertSampleToBitmap(Sample));
            DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification);

            if (features != null)
            {
                byte[] bytes = new byte[1632];
                features.Serialize(ref bytes);

                for (int x = 0; x < List_Usuarios.Count; x++)
                {
                    DPFP.Template templeate = new DPFP.Template();
                    templeate.DeSerialize(List_Usuarios[x].fingerPrint);

                    DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
                    Verificator.Verify(features, templeate, ref result);


                    if (result.Verified)
                    {
                        _idCliente = List_Usuarios[x].id_Cliente;

                        return;
                    }
                }

                //videoSourcePlayer1.BackgroundImage = Properties.Resources.Desconocido;
                MessageBox.Show("Cliente no encontrado", "Information", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }
Пример #14
0
        protected virtual void Process(DPFP.Sample Sample)
        {
            DrawPicture(ConvertSampleToBitmap(Sample));
            DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification);

            if (features != null)
            {
                byte[] bytes = new byte[1632];
                features.Serialize(ref bytes);

                for (int x = 0; x < List_Usuarios.Count; x++)
                {
                    DPFP.Template templeate = new DPFP.Template();
                    templeate.DeSerialize(List_Usuarios[x].fingerPrint);

                    DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
                    Verificator.Verify(features, templeate, ref result);

                    if (result.Verified)
                    {
                        int id_usuario = List_Usuarios[x].id_Cliente;
                        var usuario    = (from cliente in contexto.tb_Usuarios where cliente.id_usuario == id_usuario select cliente).Single();
                        MessageBox.Show("VERIFICADO  " + usuario.nombre_usuario);
                        return;
                    }
                }

                MessageBox.Show("NO ENCONTRADO");
            }
        }
Пример #15
0
        public void OnComplete(object Capture, string ReaderSerialNumber, DPFP.Sample Sample)
        {
            //Process(Sample);
            try
            {
                Connection con = new Connection();
                con.Connect();
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = " select * from resident ";
                cmd.Connection  = Connection.con;
                SqlDataAdapter sd = new SqlDataAdapter(cmd);
                DataTable      dt = new DataTable();
                sd.Fill(dt);

                foreach (DataRow dr in dt.Rows)
                {
                    byte[] _img = (byte[])dr["resident_fingerprint"];
                    //string id = dr["RESIDENT_ID"].ToString();
                    MemoryStream  ms       = new MemoryStream(_img);
                    DPFP.Template Template = new DPFP.Template();
                    Template.DeSerialize(ms);
                    DPFP.Verification.Verification Verificator = new DPFP.Verification.Verification();

                    //  Process(Sample);

                    DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification);
                    if (features != null)
                    {
                        DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
                        Verificator.Verify(features, Template, ref result);
                        // UpdateStatus(result.FARAchieved);
                        if (result.Verified)
                        {
                            MessageBox.Show("This Resident is already Registered!!!");
                            Reset();
                            FMPIclear();
                            break;
                        }
                        else
                        {
                            MakeReport("fingerprint captured.");
                            SetPrompt("Scan fingerprint again");
                            Process(Sample);
                            if (scans.Text == "0 scans left")
                            {
                                cp.StopCapture();
                            }
                            break;
                        }
                    }
                    else
                    {
                    }
                }
            }
            catch
            {
            }
        }
Пример #16
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.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("Click Close, and then click Fingerprint Verification.");

                        /*string connstring = "Host=localhost;Username=postgres;Password=posgrest;Database=SGEEDE";
                         * // Making connection with Npgsql provider
                         * NpgsqlConnection conn = new NpgsqlConnection(connstring);
                         * conn.Open();
                         * string sql = "update res_partner set comment = '123123123123123' where name = 'Agrolait';";
                         * //cmd.CommandText = "INSERT INTO Emp_T(EmpID, EmpName, EmpTemplate) VALUES('" + textBox1.Text + "','" + textBox2.Text + "','" + template + "')";
                         * // data adapter making request from our connection
                         * NpgsqlDataAdapter da = new NpgsqlDataAdapter(sql, conn);
                         * // i always reset DataSet before i do something with it.... i don't know why :-)
                         * ds.Reset();
                         *
                         * // filling DataSet with result from NpgsqlDataAdapter
                         * da.Fill(ds);
                         * // since it C# DataSet can handle multiple tables, we will select first
                         * //dt = ds.Tables[0];
                         * // connect grid to DataTable
                         * //dataGridView1.DataSource = dt;
                         * // since we only showing the result we don't need connection anymore
                         * conn.Close(); */

                        Stop();
                        break;

                    case DPFP.Processing.Enrollment.Status.Failed:                      // report failure and restart capturing
                        Enroller.Clear();
                        Stop();
                        UpdateStatus();
                        OnTemplate(null);
                        Start();
                        break;
                    }
                }
            }
        }
Пример #17
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.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.");`
                    MakeReport("The fingerprint has  been captured.");
                    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

                        byte[] fingerData = Enroller.Template.Bytes;

                        FingerTemplate = fingerData;

                        isfingertemplate = true;



                        MakeReport(message);
                        SetPrompt("Click Close to and reopend to enroll new Student");
                        MakeReport(id + " has been enrolled. Click Close this window to capture another Student");

                        Stop();

                        break;


                    //OnTemplate(Enroller.Template);


                    case DPFP.Processing.Enrollment.Status.Failed:      // report failure and restart capturing
                        Enroller.Clear();
                        Stop();
                        UpdateStatus();
                        OnTemplate(null);
                        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.Verification);
			// Check quality of the sample and start verification if it's good
			// TODO: move to a separate task
            if (features != null)
            {
                // Compare the feature set with our template
                DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
                string[] flist = Directory.GetFiles("c:/finger");
                int mx = flist.Length;
                int cnt = 0;
                bool found = false;
               
                 DPFP.Template templates;
                while (cnt < mx && !found)
                {
                   // MessageBox.Show(flist[cnt]);
                    using (FileStream fs = File.OpenRead(flist[cnt]))
                    {
                         templates = new DPFP.Template(fs);
                        Verificator.Verify(features, templates, ref result);
                        UpdateStatus(result.FARAchieved);
                    }
                    if (result.Verified)
                    {
                        found = true;
                        FileInfo nfo = new FileInfo(flist[cnt]);
                        fname = nfo.Name;                        
                        break;
                    }
                    else
                    {
                        found = false;
                        cnt++;
                    }
                }
              
            
                    if (found)
                    {
                        MakeReport("The fingerprint was VERIFIED. "+fname);
                        MessageBox.Show("Verified!!");
                        
                    
                        
                    }
                    else
                    {
                        MakeReport("The fingerprint was NOT VERIFIED.");
                        MessageBox.Show("Not Verified!!");
                    }
                
            }
		}
Пример #19
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();
            }
        }
Пример #20
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!");
            //}
        }
        public void OnComplete(object Control, DPFP.FeatureSet FeatureSet, ref DPFP.Gui.EventHandlerStatus Status)
        {
            DPFP.Verification.Verification        ver = new DPFP.Verification.Verification();
            DPFP.Verification.Verification.Result res = new DPFP.Verification.Verification.Result();

            try
            {
                string mem = null;
                con.Open();
                SqlCommand    cmd      = new SqlCommand("select memName,finger from familyMembers where CardNo='" + CardNo + "'", con);
                SqlDataReader dr       = cmd.ExecuteReader();
                DPFP.Template template = new DPFP.Template();
                while (dr.Read())
                {
                    mem = dr["memName"].ToString();
                    byte[] tmp = (byte[])dr["finger"];
                    template.DeSerialize(tmp);

                    if (template != null)
                    {
                        ver.Verify(FeatureSet, template, ref res);
                        Data.IsFeatureSetMatched = res.Verified;
                        Data.FalseAcceptRate     = res.FARAchieved;
                        string rate = Data.FalseAcceptRate.ToString() + "00";
                        string sp   = rate.Remove(2);
                        label1.Text = sp + " %";
                        if (sp == "00")
                        {
                            label1.Text = "100 %";
                        }

                        if (res.Verified)
                        {
                            MessageBox.Show("Verification Success");
                            con.Close();
                            UserLogin.member = mem;
                            return;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                con.Close();
            }

            //if (!res.Verified)
            //    Status = DPFP.Gui.EventHandlerStatus.Failure;
            //MessageBox.Show("Unauthorized User");
            Data.Update();
        }
Пример #22
0
        public void OnComplete(object Control, DPFP.FeatureSet FeatureSet, ref DPFP.Gui.EventHandlerStatus Status)
        {
            DPFP.Verification.Verification        ver = new DPFP.Verification.Verification();
            DPFP.Verification.Verification.Result res = new DPFP.Verification.Verification.Result();

            foreach (Staff dt in tempstorage.TempStaffs)
            {
                // Compare feature set with all stored templates.
                foreach (DPFP.Template template in dt.Templates)
                {
                    // Get template from storage.
                    if (template != null)
                    {
                        // Compare feature set with particular template.
                        ver.Verify(FeatureSet, template, ref res);
                        //dt.IsFeatureSetMatched = res.Verified;
                        //dt.FalseAcceptRate = res.FARAchieved;
                        if (res.Verified)
                        {
                            //search for the staff attendance that day
                            Attendance attdance = tempstorage.TempAttendance.Find(x => x.AdminId == tempstorage.TempStaffs.IndexOf(dt).ToString() && x.AttendanceDate == DateTime.Today.Date.ToShortDateString());

                            if (attdance != null)
                            {
                                MessageBox.Show("Attendance already taken for the day.");
                            }
                            else
                            {
                                //keep a spot for attendance
                                Attendance attd = new Attendance();
                                attd.AdminName      = dt.FirstName + " " + dt.LastName;
                                attd.AdminId        = tempstorage.TempStaffs.IndexOf(dt).ToString();
                                attd.AttendanceDate = DateTime.Today.Date.ToShortDateString();
                                attd.TimeIn         = DateTime.Now.TimeOfDay.ToString();
                                tempstorage.TempAttendance.Add(attd);
                                ListEvents.Items.Insert(0, String.Format("Attendance taken for staff: {0}, Time In: {1}, Date: {2}", attd.AdminName, attd.TimeIn, attd.AttendanceDate));
                            }

                            break; // success
                        }
                    }
                }
                if (res.Verified)
                {
                    break; // success
                }
            }



            if (!res.Verified)
            {
                Status = DPFP.Gui.EventHandlerStatus.Failure;
            }
        }
Пример #23
0
        protected override void Process(DPFP.Sample Sample)
        {
            base.Process(Sample);

            // Process the sample and create a feature set for the enrolment 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)
            {
                MySqlConnection cnn = new MySqlConnection();
                //connection to database
                cnn.ConnectionString = "Server=localhost;Database=fpExam;Uid=root;Pwd=;";;
                cnn.Open();
                try
                {
                    MySqlCommand    cmd = new MySqlCommand("SELECT * FROM tbStudFP WHERE Matric_No='" + txtMatric.Text + "'", cnn);
                    MySqlDataReader dr  = cmd.ExecuteReader();
                    while (dr.Read())
                    {
                        byte[]       fpbyte = (byte[])dr["FpTemplate"];
                        MemoryStream stream = new MemoryStream(fpbyte);
                        Template = new DPFP.Template(stream);
                        // Compare the feature set with our template
                        DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
                        Verificator.Verify(features, Template, ref result);
                        UpdateStatus(result.FARAchieved);
                        if (result.Verified)
                        {
                            MakeReport("The Fingerprint was VERIFIED SUCCESSFULLY");
                            TxtFullname(dr["Full_Name"].ToString());
                            TxtLevel(dr["Level"].ToString());
                            TxtDept(dr["Department"].ToString());
                        }
                        else
                        {
                            MakeReport("The Fingerprint NOT FOUND!.");
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    cnn.Close();
                }
            }
            else
            {
                MakeReport("Fingerprint does not Exist");
            }
        }
Пример #24
0
 protected DPFP.FeatureSet ExtractFeatures(DPFP.Sample Sample, DPFP.Processing.DataPurpose Purpose)
 {
     DPFP.Processing.FeatureExtraction Extractor = new DPFP.Processing.FeatureExtraction();
     DPFP.Capture.CaptureFeedback feedback = DPFP.Capture.CaptureFeedback.None;
     DPFP.FeatureSet features = new DPFP.FeatureSet();
     Extractor.CreateFeatureSet(Sample, Purpose, ref feedback, ref features);
     if (feedback == DPFP.Capture.CaptureFeedback.Good)
         return features;
     else
         return null;
 }
Пример #25
0
 public DPFP.FeatureSet ExtractFeatures(DPFP.Sample Sample, DPFP.Processing.DataPurpose Purpose)
 {
     DPFP.Processing.FeatureExtraction Extractor = new DPFP.Processing.FeatureExtraction();
     DPFP.Capture.CaptureFeedback feedback = DPFP.Capture.CaptureFeedback.None;
     DPFP.FeatureSet features = new DPFP.FeatureSet();
     Extractor.CreateFeatureSet(Sample, Purpose, ref feedback, ref features);
     if (feedback == DPFP.Capture.CaptureFeedback.Good)
         return features;
     else
         return null;
 }
Пример #26
0
 protected DPFP.FeatureSet ExtractFeatures(DPFP.Sample Sample, DPFP.Processing.DataPurpose Purpose)
 {
     DPFP.Processing.FeatureExtraction Extractor = new DPFP.Processing.FeatureExtraction();	// Create a feature extractor
     DPFP.Capture.CaptureFeedback feedback = DPFP.Capture.CaptureFeedback.None;
     DPFP.FeatureSet features = new DPFP.FeatureSet();
     Extractor.CreateFeatureSet(Sample, Purpose, ref feedback, ref features);			// TODO: return features as a result?
     if (feedback == DPFP.Capture.CaptureFeedback.Good)
         return features;
     else
         return null;
 }
Пример #27
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();
            }
        }
Пример #28
0
        protected void Process(DPFP.Sample Sample)
        {
            TimeSpan begin = TimeSpan.Parse("07:00");
            TimeSpan stop  = TimeSpan.Parse("19:00");
            TimeSpan now   = DateTime.Now.TimeOfDay;

            if (now >= begin && now <= stop)
            {
                bool verified = false;
                // 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.Verification);

                // Check quality of the sample and start verification if it's good
                // TODO: move to a separate task
                if (features != null)
                {
                    foreach (var val in list)
                    {
                        Staff_finger = val;
                        f_print      = Convert.FromBase64String(val);
                        DPFP.Template temp = new DPFP.Template();
                        temp.DeSerialize(f_print);
                        Template = temp;


                        DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
                        Verificator.Verify(features, Template, ref result);
                        //UpdateStatus(result.FARAchieved);
                        if (result.Verified)
                        {
                            verified = true;
                            MakeReport("The fingerprint was VERIFIED.");
                            checktimeOut();
                            //dbAccess();
                        }
                    }
                    // Compare the feature set with our template
                    if (!verified)
                    {
                        MessageBox.Show("Invalid staff");
                    }
                }
            }
            else
            {
                MessageBox.Show("System Inactive");
            }
        }
Пример #29
0
        public override void Process(DPFP.Sample Sample)
        {
            base.Process(Sample);
            this.Data.Images[this.FingerPosition] = Picture.Image;
            this.Data.UpdateSamples(this.FingerPosition, Sample);

            // Process the sample and create a feature set for the enrollment purpose.
            DPFP.FeatureSet features = Util.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);
                        this.Data.UpdateTemplates(this.FingerPosition, Enroller.Template);

                        this.IsComplete = true;
                        SetPrompt("Click Close, and then click Fingerprint Verification.");
                        Stop();
                        if (IsAutoClose == true)
                        {
                            this.Invoke(new Function(delegate()
                            {
                                this.Close();
                            }));
                        }
                        break;

                    case DPFP.Processing.Enrollment.Status.Failed:      // report failure and restart capturing
                        Enroller.Clear();
                        Stop();
                        UpdateStatus();
                        //OnTemplate(null);
                        Start();
                        break;
                    }
                }
            }
        }
Пример #30
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;
                    }
                }
            }
        }
Пример #31
0
 protected DPFP.FeatureSet ExtractFeatures(DPFP.Sample Sample, DPFP.Processing.DataPurpose Purpose)
 {
     DPFP.Processing.FeatureExtraction Extractor = new DPFP.Processing.FeatureExtraction();              // Create a feature extractor
     DPFP.Capture.CaptureFeedback      feedback  = DPFP.Capture.CaptureFeedback.None;
     DPFP.FeatureSet features = new DPFP.FeatureSet();
     Extractor.CreateFeatureSet(Sample, Purpose, ref feedback, ref features);                                    // TODO: return features as a result?
     if (feedback == DPFP.Capture.CaptureFeedback.Good)
     {
         return(features);
     }
     else
     {
         return(null);
     }
 }
Пример #32
0
 public Form2()
 {
     InitializeComponent();
     graphics = this.CreateGraphics();
     font     = new Font("Times New Roman", 12, FontStyle.Bold, GraphicsUnit.Pixel);
     DPFP.Capture.ReadersCollection coll = new
                                           DPFP.Capture.ReadersCollection();
     regFeatures = new DPFP.FeatureSet[4];
     for (int i = 0; i < 4; i++)
     {
         regFeatures[i] = new DPFP.FeatureSet();
     }
     verFeatures       = new DPFP.FeatureSet();
     createRegTemplate = new DPFP.Processing.Enrollment();
     readers           = new DPFP.Capture.ReadersCollection();
     for (int i = 0; i < readers.Count; i++)
     {
         readerDescription = readers[i];
         if ((readerDescription.Vendor == "Digital Persona, Inc.") ||
             (readerDescription.Vendor == "DigitalPersona, Inc."))
         {
             try
             {
                 capturer = new
                            DPFP.Capture.Capture(readerDescription.SerialNumber,
                                                 DPFP.Capture.Priority.Normal);//CREAMOS UNA OPERACION DE CAPTURAS.
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
             }
             capturer.EventHandler = this; //AQUI CAPTURAMOS LOS EVENTOS.
             converter             = new DPFP.Capture.SampleConversion();
             try
             {
                 verify = new DPFP.Verification.Verification();
             }
             catch (Exception ex)
             {
                 MessageBox.Show("Ex: " + ex.ToString());
             }
             break;
         }
     }
 }