示例#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;
            }
        }
示例#2
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();
 }
        protected override void Process(DPFP.Sample Sample)
        {
            base.Process(Sample);


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


            var FileReader = new CargaFileHandler();

            if (features != null)
            {
                var biometrias = FileReader.ReadBiometriasFile("digitalPersona");


                foreach (var bio in biometrias)
                {
                    DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
                    try
                    {
                        Template t = new Template();
                        t.DeSerialize(bio.GetBytes());

                        Verificator.Verify(features, t, ref result);
                    }
                    catch { OnVerify?.Invoke(false, ""); return; };
                    if (result.Verified)
                    {
                        OnVerify?.Invoke(true, bio.Chave);
                        return;
                    }
                }
                OnVerify?.Invoke(false, "");
            }
        }
        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);
                }
            }
        }
        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();
        }
示例#6
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);
            }
        }
        public void OnComplete(object Capture, string ReaderSerialNumber, DPFP.Sample Sample)
        {
            MakeReport("fingerprint captured.");
            SetPrompt("Scan fingerprint again");
            //Process(Sample);
            try
            {
                Connection con = new Connection();
                con.Connect();
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = "select RESIDENT_FINGERPRINT, RESIDENT.RESIDENT_ID,PROGRAM.PROGRAM_ID,LIST.RESIDENT_ID,LIST.PROGRAM_ID FROM RESIDENT LEFT JOIN LIST ON RESIDENT.RESIDENT_ID = LIST.RESIDENT_ID LEFT JOIN PROGRAM ON PROGRAM.PROGRAM_ID = RESIDENT.RESIDENT_ID WHERE LIST.PROGRAM_ID ='" + label2.Text + "' AND LIST_VERIFICATION IS NULL";
                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();
                    string pid  = dr["PROGRAM_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("Verified!!!");
                            SqlCommand cmds = new SqlCommand();
                            cmds.CommandText = "UPDATE LIST SET LIST_VERIFICATION ='True' WHERE LIST.RESIDENT_ID = '" + id.ToString() + "' AND LIST.PROGRAM_ID = '" + label2.Text + "'";
                            cmds.Connection  = Connection.con;
                            SqlDataReader dar = cmds.ExecuteReader();
                        }
                        else
                        {
                            MakeReport("Not registered as a resident!");
                        }
                    }
                    else
                    {
                    }
                }
            }
            catch
            {
            }
        }
示例#8
0
        void VerificationControl_OnComplete(object control, FeatureSet featureSet, ref DPFP.Gui.EventHandlerStatus eventHandlerStatus)
        {
            // Verify Here
            var ver             = new DPFP.Verification.Verification();
            var res             = new DPFP.Verification.Verification.Result();
            var fingerTemplates = new BeneficiaryRepository().GetFingerTemplates();

            // Compare feature set with all stored templates.


            foreach (var template in fingerTemplates)
            {
                // 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)
            {
                eventHandlerStatus = DPFP.Gui.EventHandlerStatus.Failure;
            }

            //_data.Update();
        }
示例#9
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);
            }
        }
示例#10
0
        protected void Compare(Template template, Sample sample)
        {
            try
            {
                // Process the sample and create a feature set for the enrollment purpose.
                //MemoryStream ms = new MemoryStream(Funciones.ImageToByteArray(this.picHuella.Image));
                //DPFP.Sample sample = new DPFP.Sample(ms);
                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)
                    {
                        MessageBox.Show(this, "El usuario coincide con el existente!", "Validador Huella", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        MakeReport("El usuario coincide con el existente!");
                    }
                    else
                    {
                        MessageBox.Show(this, "El usuario No coincide con el existente!", "Validador Huella", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        MakeReport("El usuario No coincide con el existente!.");
                    }
                }
            }
            catch (Exception ex)
            {
                MakeReport(ex.Message);
            }
        }
        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();
                }
            }
        }
示例#12
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");
            }
        }
示例#13
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 = "";
        }
示例#14
0
        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;
            }
        }
示例#15
0
        public void OnComplete(object Capture, string ReaderSerialNumber, Sample Sample)
        {
            SetImagePawprint(Sample);
            DPFP.FeatureSet featureSet = CreateFeatureSet(Sample, DPFP.Processing.DataPurpose.Verification);

            if (featureSet != null)
            {
                DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();

                List <User> ListUser = mySqlAdapter.GetAllUsers();

                foreach (User user in ListUser)
                {
                    MemoryStream ms = new MemoryStream(user.Pawprint);
                    template.DeSerialize(ms.ToArray());

                    verification.Verify(featureSet, template, ref result);

                    if (result.Verified)
                    {
                        display("Hola: " + user.Name);
                        break;
                    }
                    else
                    {
                        display("No match found");
                    }
                }
            }
            else
            {
                MessageBox.Show("Nothing found here");
            }
        }
示例#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.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;
                    }
                }
            }
        }
示例#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.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.");
                }
            }
        }
示例#18
0
        protected override void Process(DPFP.Sample Sample)
        {
            base.Process(Sample);

            DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification);
            if (features != null)
            {
                DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
                DPFP.Template template = new DPFP.Template();
                Stream        stream;
                //foreach (var item in context.Students)
                //{
                //    stream = new MemoryStream(item.Pattern);
                //    template = new DPFP.Template(stream);
                //        Verificator.Verify(features, template, ref result);

                //    UpdateStatus(result.FARAchieved);
                //    if(result.Verified)
                //    {
                //        MakeReport("FingerPrint was verified" + item.Name);
                //        MessageBox.Show("User " + item.Name + " found.");
                //        break;
                //    }

                //}
            }
        }
示例#19
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
            {
            }
        }
		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!!");
                    }
                
            }
		}
        public void Verify(DPFP.Sample Sample)
        {
            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);
                if (result.Verified)
                {
                    this.Dispatcher.Invoke(() =>
                    {
                        if (this.ClockShow != null)
                            this.ClockShow.Controller.Pause();
                        ColorAnimation animation = new ColorAnimation();
                        animation.From = (this.UIFinger_Printer.Foreground as SolidColorBrush).Color;
                        animation.To = Colors.Green;
                        animation.Duration = new Duration(TimeSpan.FromMilliseconds(450));
                        animation.EasingFunction = new PowerEase() { Power = 5, EasingMode = EasingMode.EaseInOut };
                        animation.Completed += (s,e) => 
                        {
                            App.curUser = UserData.Info(this.cacheName);
                            App.curUserID = App.curUser.ID;
                            if (this.UIAutoLogin.IsChecked.Value)
                            {
                                App.cache.hashUserName = App.getHash(App.curUserID);
                                App.cache.userName = Encrypt.EncryptString(this.UITxtName.Text.Trim(), FunctionStatics.getCPUID());
                                AltaCache.Write(App.CacheName, App.cache);
                            }
                            else
                            {
                                App.cache.userName = string.Empty;
                                App.cache.hashUserName = string.Empty;
                            }
                            this.UIFullName.Text = App.curUser.Full_Name;
                            this.UILoginFinger.Animation_Translate_Frame(double.NaN, double.NaN, 400, double.NaN, 500);
                            this.UILoginSusscess.Animation_Translate_Frame(-400, double.NaN, 0, double.NaN, 500, () => { LoadData(); });
                        };
                        this.ClockHide = animation.CreateClock();
                        this.UIFinger_Printer.Foreground.ApplyAnimationClock(SolidColorBrush.ColorProperty, ClockHide);
                        this.UIFinger_Status.Text = string.Empty;
                    });                   
                    this.Stop();
                }
                else
                {
                    this.Dispatcher.Invoke(() =>
                    {
                        this.UIFinger_Status.Text = "Try again ...";
                    });
                }
            }
        }
示例#22
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();
        }
示例#24
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");
            }
        }
        protected override void Process(DPFP.Sample Sample)
        {
            try
            {
                // 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)
                {
                    DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
                    bool found = false;
                    int  index = 0;
                    // Compare the feature set with each of our template

                    for (int i = 0; i < Templates.Count; i++)
                    {
                        var template = Templates[i];
                        Verificator.Verify(features, template, ref result);

                        if (result.Verified)
                        {
                            found = true;

                            MakeReport("VERIFIED SUCCESSFULLY.");

                            Staff = Fingerprints[i].Staff;

                            this.Invoke(new Function(delegate()
                            {
                                this.StaffVerified?.Invoke(this, new EventArgs());
                            }));


                            Start();
                            break;
                        }
                        index++;
                    }
                    if (!found)
                    {
                        MakeReport("VERIFY FAILED.");
                        Start();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("An error occured while comparing with fingerprint database. \n\r\n\r" + ex.ToString());
            }
        }
示例#26
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;
            }
        }
示例#27
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");
            }
        }
示例#28
0
        public static bool Verify(DPFP.Template template, DPFP.Sample sample)
        {
            var verificator = new DPFP.Verification.Verification();

            DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
            // Process the sample and create a feature set for verification.
            DPFP.FeatureSet features = ExtractFeatures(sample, DPFP.Processing.DataPurpose.Verification);
            if (features != null)
            {
                // Compare the feature set with our template
                verificator.Verify(features, template, ref result);
            }
            return(result.Verified);
        }
示例#29
0
        protected void ProcessVerify(DPFP.Sample Sample)
        {
            try
            {
                // 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)
                {
                    DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
                    bool found = false;
                    int  index = 0;
                    // Compare the feature set with each of our template
                    foreach (var llt in Owners)
                    {
                        Verificator.Verify(features, llt, ref result);

                        if (result.Verified)
                        {
                            found = true;
                            using (var db = new LandxEntities())
                            {
                                Dlandlord = db.People.Find(psnId);
                            }
                            MakeReport("The fingerprint was VERIFIED.");
                            displayMsg("Welcome " + Dlandlord.ApplicantsFullname);
                            enableNextFP();

                            break;
                        }
                        index++;
                    }
                    if (!found)
                    {
                        MakeReport("The fingerprint was NOT VERIFIED.");
                    }
                }

                Capturer.StartCapture();
            }
            catch (Exception ex)
            {
                MessageBox.Show("An error occured while comparing with fingerprint database. \n\r\n\r" + ex.ToString());
            }
        }
示例#30
0
        protected virtual void Process(DPFP.Sample Sample)
        {
            Bitmap BMP = ConvertSampleTobitmap(Sample);

            DrawPicture(BMP);
            DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification);

            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);
                Verificador(result.Verified);
            }
        }
示例#31
0
        public bool NonUnique(ref Bitmap LeftFinger, ref Bitmap RightFinger)
        {
            try
            {
                // convert the leftfinger to sample
                Sample LeftSample = ConvertRawBmpAsSample(LeftFinger);

                // convert the right finger as template
                Template RightTemplate = ConvertRawBmpAsTemplate(RightFinger, DataPurpose.Verification);

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

                Stopwatch sw = new Stopwatch();
                // Check quality of the sample and start verification if it's good
                if (features != null & RightTemplate != null)
                {
                    // loads the collection

                    DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();

                    // timer for current comparison
                    sw.Start();

                    result = DPFP.Verification.Verification.Verify(features, RightTemplate, 0x7FFFFFFF / 100000);

                    if (result.Verified)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                    sw.Stop();
                }
                else
                {
                    throw new Exception("Fingerprint is of low quality");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(false);
        }
示例#32
0
        protected void Process(DPFP.Sample 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;

                //Obtenemos una lista con los datos del usuario.
                List <Usuario> conexiones = ConexionBD.Muestra();

                foreach (var con in conexiones)
                {
                    if (con.huella != null)
                    {
                        stream   = new MemoryStream(con.huella);
                        template = new DPFP.Template(stream);
                        try
                        {
                            Verificator.Verify(features, template, ref result);
                        }
                        catch (Exception e)
                        {
                            MessageBox.Show("error" + e.Message);
                        }

                        if (result.Verified)
                        {
                            this.Dispatcher.Invoke(new Function(delegate() {
                                Desplegar(con);
                            }));

                            break;
                        }
                    }
                }
            }
        }
    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();
    }
 protected virtual void Process(DPFP.Sample Sample)
 {
     huella.DrawPicture(huella.ConvertSampleToBitmap(Sample), pcbHuella);
     DPFP.FeatureSet features = huella.ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Enrollment);
     if (features != null) 
         {
             DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
             Verificator.Verify(features, Template, ref result);
         }
         
         
 }
        public void Verify(DPFP.Sample Sample)
        {
            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();
                try
                {

                    Verificator.Verify(features, this.curTemplate , ref result);
                    if (result.Verified)
                    {
                        this.Dispatcher.Invoke(() =>
                        {
                            if (this.ClockShow != null)
                                this.ClockShow.Controller.Pause();
                            ColorAnimation animation = new ColorAnimation();
                            animation.From = (this.UIFinger_Printer.Foreground as SolidColorBrush).Color;
                            animation.To = Colors.Green;
                            animation.Duration = new Duration(TimeSpan.FromMilliseconds(450));
                            animation.EasingFunction = new PowerEase() { Power = 5, EasingMode = EasingMode.EaseInOut };
                            this.ClockHide = animation.CreateClock();
                            this.UIFinger_Printer.Foreground.ApplyAnimationClock(SolidColorBrush.ColorProperty, ClockHide);
                            flagFinger = true;
                        });
                        this.Stop();
                    }
                    else
                    {

                    }
                }
                catch (Exception)
                {
                  
                }
            }
        }
示例#36
0
        protected void Compare(Template template, Sample sample)
        {
            try
            {
                // Process the sample and create a feature set for the enrollment purpose.
                //MemoryStream ms = new MemoryStream(Funciones.ImageToByteArray(this.picHuella.Image));
                //DPFP.Sample sample = new DPFP.Sample(ms);
                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)
                    {
                        MessageBox.Show(this, "El usuario coincide con el existente!", "Validador Huella", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        MakeReport("El usuario coincide con el existente!");
                    }
                    else
                    {
                        MessageBox.Show(this, "El usuario No coincide con el existente!", "Validador Huella", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        MakeReport("El usuario No coincide con el existente!.");
                    }
                }
            }
            catch (Exception ex)
            {
                MakeReport(ex.Message);
            }
        }
        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();

            //string conStr = "Data Source=.; Initial Catalog=Registration; Integrated Security=true";

            //SqlConnection con = new SqlConnection(conStr);
            //SqlCommand cmd = new SqlCommand("Select FingerPrintData from FingerPrints where Id = 11", con);

            //con.Open();

            //byte[] userFingerPrintData = new byte[0];

            //using (con)
            //{
            //    userFingerPrintData = cmd.ExecuteScalar() as byte[];
            //}

            //byte[] fingerPrintCode = new StudentDAC().GetFingerCodeById(2);

            List<Guardian> guardians = new GuardianDAC().SelectAllGuardians();
           
            if (guardians != null && guardians.Count > 0)
            {
                foreach (var item in guardians)
                {
                    ver = new DPFP.Verification.Verification();
                    res = new DPFP.Verification.Verification.Result();
                    DPFP.Template temp = new DPFP.Template();

                    if (item.FingerCode != null)
                    {
                        temp.DeSerialize(item.FingerCode);

                        if (temp != null)
                        {
                            // Compare feature set with particular template.

                            ver.Verify(FeatureSet, temp, ref res);

                            if (res.Verified)
                            {
                                guardiansTakeAwayForm.guardian = item;

                                this.Close();
                                break;
                            }
                        }
                    }
                    
                }
            }

            
            
            if (!res.Verified)
                Status = DPFP.Gui.EventHandlerStatus.Failure;

        }
    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();

            string conStr = "Data Source=.; Initial Catalog=Registration; Integrated Security=true";

            SqlConnection con = new SqlConnection(conStr);
            SqlCommand cmd = new SqlCommand("Select FingerPrintData from FingerPrints where Id = 6", con);

            con.Open();

            byte[] userFingerPrintData = new byte[0];

            using (con)
            {
                userFingerPrintData = cmd.ExecuteScalar() as byte[];
            }

            DPFP.Template temp = new DPFP.Template();
            temp.DeSerialize(userFingerPrintData);

            if (temp != null)
            {
                // Compare feature set with particular template.

                ver.Verify(FeatureSet, temp, ref res);
                Data.IsFeatureSetMatched = res.Verified;
                Data.FalseAcceptRate = res.FARAchieved;
            }


            // 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();
    }