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) try { for (int i = -1; i < Enroller.FeaturesNeeded; i++) { Enroller.AddFeatures(features); } Enroller.AddFeatures(features); } finally { switch (Enroller.TemplateStatus) { case DPFP.Processing.Enrollment.Status.Ready: MessageBox.Show("Se ha generado correctamente el templete de la huella", "Correcto", MessageBoxButtons.OK, MessageBoxIcon.Information); MemoryStream ms = new MemoryStream(); huella.Stop(Capturador); Enroller.Template.Serialize(ms); break; case DPFP.Processing.Enrollment.Status.Failed: Enroller.Clear(); huella.Stop(Capturador); huella.Start(Capturador); break; } } }
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; } }
public static void GetEmployeeMatches(List<Employee> list, DPFP.Sample Sample,int FingerNo) { OracleConnection conn = new OracleConnection(ConStr); Employee info = null; string FingerDesc = Util.GetFingerDesc(FingerNo); try { string _result = string.Empty; string sql = "select Empl_Id_No,RTF,RIF,RMF,RRF,RSF,LTF,LIF,LMF,LRF,LSF from EMPTSI"; OracleCommand command = new OracleCommand(sql, conn); command.CommandType = CommandType.Text; conn.Open(); OracleDataReader reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { info = dcEmployee.GetInfo(reader, Sample, FingerDesc); AddInfo(list, info); } } if (conn.State == ConnectionState.Open) conn.Close(); } catch (Exception ex) { throw ex; } }
public static Employee GetInfo(OracleDataReader reader, DPFP.Sample Sample, string Finger) { OracleConnection conn = new OracleConnection(ConStr); Employee _info = null; DPFP.Template _template = null; bool IsFound = false; if (reader[Finger] != DBNull.Value) { _template = Util.ProcessDBTemplate((byte[])reader[Finger]); IsFound = Util.Verify(Sample, _template); } if (IsFound == true) { string sqlEmp = "select * from employees where Empl_Id_No=" + reader["Empl_Id_No"]; OracleCommand cmd = new OracleCommand(sqlEmp, conn); cmd.CommandType = CommandType.Text; conn.Open(); OracleDataReader odr = cmd.ExecuteReader(); if (odr.HasRows) { _info = new Employee(); _info.Empl_Id_No = Convert.ToInt32(reader["Empl_Id_No"]); _info.Empl_Name = (string)odr["Empl_Name"]; _info.Empl_Deptname = (string)odr["Empl_Deptname"]; _info.Shift_Id = Convert.ToInt32(odr["Shift_Id"]); } odr.Dispose(); cmd.Dispose(); conn.Close(); conn.Dispose(); } return _info; }
public Bitmap ConvertSampleToBitmap(DPFP.Sample Sample) { DPFP.Capture.SampleConversion Convertor = new DPFP.Capture.SampleConversion(); Bitmap bitmap = null; Convertor.ConvertToPicture(Sample, ref bitmap); return bitmap; }
public void OnSampleQuality(object Capture, string ReaderSerialNumber, DPFP.Capture.CaptureFeedback CaptureFeedback) { if (CaptureFeedback == DPFP.Capture.CaptureFeedback.Good) MakeReport("La calidad de la muestra de huella digital ha sido buena."); else MakeReport("La calidad de la muestra de huella digital no ha sido del todo buena."); }
public void OnSampleQuality(object Capture, string ReaderSerialNumber, DPFP.Capture.CaptureFeedback CaptureFeedback) { if (CaptureFeedback == DPFP.Capture.CaptureFeedback.Good) MakeReport("The quality of the fingerprint sample is good."); else MakeReport("The quality of the fingerprint sample is poor."); }
public static Bitmap ConvertSampleToBitmap(DPFP.Sample Sample) { DPFP.Capture.SampleConversion Convertor = new DPFP.Capture.SampleConversion(); // Create a sample convertor. Bitmap bitmap = null; // TODO: the size doesn't matter Convertor.ConvertToPicture(Sample, ref bitmap); // TODO: return bitmap as a result return bitmap; }
// event handling public void EnrollmentControl_OnEnroll(Object Control, int Finger, DPFP.Template Template, ref DPFP.Gui.EventHandlerStatus Status) { if (Data.IsEventHandlerSucceeds) { Data.Templates[Finger - 1] = Template; // store a finger template ExchangeData(true); // update other data byte[] FingerPrintData = new byte[0]; Template.Serialize(ref FingerPrintData); string conStr = "Data Source=.; Initial Catalog=Registration; Integrated Security=true"; SqlConnection con = new SqlConnection(conStr); SqlCommand cmd = new SqlCommand("Insert into FingerPrints([FingerPrintData]) values(@fingerData)", con); cmd.Parameters.Add("@fingerData", SqlDbType.VarBinary); cmd.Parameters["@fingerData"].Value = FingerPrintData; con.Open(); using (con) { cmd.ExecuteNonQuery(); } ListEvents.Items.Insert(0, String.Format("OnEnroll: finger {0}", Finger)); } else Status = DPFP.Gui.EventHandlerStatus.Failure; // force a "failure" status }
public void OnComplete(object Capture, string ReaderSerialNumber, DPFP.Sample Sample) { //MakeReport("La huella digital fue capturada."); //SetPrompt("Scan the same fingerprint again."); SetStatus("La huella digital fue capturada!"); MakeReport("Se ha capturado la huella digital"); Process(Sample); }
public void EnrollmentControl_OnDelete(Object Control, int Finger, ref DPFP.Gui.EventHandlerStatus Status) { if (Data.IsEventHandlerSucceeds) { Data.Templates[Finger - 1] = null; // clear the finger template ExchangeData(true); // update other data ListEvents.Items.Insert(0, String.Format("OnDelete: finger {0}", Finger)); } else Status = DPFP.Gui.EventHandlerStatus.Failure; // force a "failure" status }
public static Employee VerifyBiometricsData(int FingNo, DPFP.Sample Sample) { OracleConnection conn = new OracleConnection(ConStr); Employee _info = new Employee(); try { string _result = string.Empty; string _Finger = Util.GetFingerDesc(FingNo); DPFP.Template _template = null; string sql = string.Format("select Empl_Id_No, {0} from EMPTSI", _Finger); ; OracleCommand command = new OracleCommand(sql, conn); command.CommandType = CommandType.Text; conn.Open(); OracleDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection); bool IsFound = false; if (reader.HasRows) { while (reader.Read()) { if (reader[0] != DBNull.Value) { _template = Util.ProcessDBTemplate((byte[])reader[_Finger]); IsFound = Util.Verify(Sample, _template); } if (IsFound == true) { string sqlEmp = "select * from employees where Empl_Id_No=" + reader["Empl_Id_No"]; OracleCommand cmd2 = new OracleCommand(sqlEmp, conn); cmd2.CommandType = CommandType.Text; OracleDataReader reader2 = cmd2.ExecuteReader(CommandBehavior.CloseConnection); if (reader2.HasRows) { _info.Empl_Id_No = Convert.ToInt32(reader["Empl_Id_No"]); _info.Empl_Name = (string)reader2["Empl_Name"]; _info.Empl_Deptname = (string)reader2["Empl_Deptname"]; _info.Shift_Id = Convert.ToInt32(reader2["Shift_Id"]); } reader2.Dispose(); reader.Dispose(); cmd2.Dispose(); command.Dispose(); break; } } } if (conn.State == ConnectionState.Open) conn.Close(); return _info; } catch (Exception ex) { throw ex; } }
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 ..."; }); } } }
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; }
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; }
public void Stop(DPFP.Capture.Capture Capturador) { if (null != Capturador) { try { Capturador.StopCapture(); } catch { } } }
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; } } }
// event handling public void EnrollmentControl_OnEnroll(Object Control, int Finger, DPFP.Template Template, ref DPFP.Gui.EventHandlerStatus Status) { if (Data.IsEventHandlerSucceeds) { Data.Templates[Finger - 1] = Template; // store a finger template ExchangeData(true); // update other data byte[] FingerPrintData = new byte[0]; Template.Serialize(ref FingerPrintData); //string conStr = "Data Source=.; Initial Catalog=Registration; Integrated Security=true"; //SqlConnection con = new SqlConnection(conStr); //SqlCommand cmd = new SqlCommand("Insert into FingerPrints([FingerPrintData]) values(@fingerData)", con); //cmd.Parameters.Add("@fingerData", SqlDbType.VarBinary); //cmd.Parameters["@fingerData"].Value = FingerPrintData; //con.Open(); //using (con) //{ // cmd.ExecuteNonQuery(); //} //bool updateStudent = new StudentDAC().UpdateFingerCode(studentId, FingerPrintData); if (type == "Student") { addStudentForm.student.FingerCode = FingerPrintData; } else if (type == "Guardian") { addGuardianForm.guardian.FingerCode = FingerPrintData; } this.Close(); ListEvents.Items.Insert(0, String.Format("OnEnroll: finger {0}", Finger)); } else Status = DPFP.Gui.EventHandlerStatus.Failure; // force a "failure" status }
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(); }
public override void Process(DPFP.Sample Sample) { try { base.Process(Sample); frmMain _frm = this._ParentForm; byte[] _byte = null; Sample.Serialize(ref _byte); //Wait Start this.Invoke(new Function(delegate() { this.lblPlsWait.Visible = true; })); Profile info = zsi.PhotoFingCapture.Models.DataControllers.dcProfile_SQL.VerifyBiometricsData(GetFingNo(), _byte); //WaitStop this.Invoke(new Function(delegate() { this.lblPlsWait.Visible = false; })); if (info.ProfileId > 0) { ProcessProfile(info); } else { MessageBox.Show("Finger not identified"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public override void Process(DPFP.Sample Sample) { try { base.Process(Sample); frmMain _frm = this._ParentForm; //Wait Start this.Invoke(new Function(delegate() { this.lblPlsWait.Visible = true; })); Employee info = zsi.dtrs.Models.DataControllers.dcEmployee.VerifyBiometricsData(GetFingNo(), Sample); //WaitStop this.Invoke(new Function(delegate() { this.lblPlsWait.Visible = false; })); if (info!=null) { ProcessProfile(info); } else { MessageBox.Show("Finger not identified"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private static bool Verify(OracleDataReader dr, DPFP.Sample sample) { try { DPFP.Template _template = null; //right fingers if (dr["RTF"] != DBNull.Value) { _template = Util.ProcessDBTemplate((byte[])dr["RTF"]); if (Util.Verify(sample, _template)) goto Found; } if (dr["RIF"] != DBNull.Value) { _template = Util.ProcessDBTemplate((byte[])dr["RIF"]); if (Util.Verify(sample, _template)) goto Found; } if (dr["RMF"] != DBNull.Value) { _template = Util.ProcessDBTemplate((byte[])dr["RMF"]); if (Util.Verify(sample, _template)) goto Found; } if (dr["RRF"] != DBNull.Value) { _template = Util.ProcessDBTemplate((byte[])dr["RRF"]); if (Util.Verify(sample, _template)) goto Found; } if (dr["RSF"] != DBNull.Value) { _template = Util.ProcessDBTemplate((byte[])dr["RSF"]); if (Util.Verify(sample, _template)) goto Found; } //left fingers if (dr["LTF"] != DBNull.Value) { _template = Util.ProcessDBTemplate((byte[])dr["LTF"]); if (Util.Verify(sample, _template)) goto Found; } if (dr["LIF"] != DBNull.Value) { _template = Util.ProcessDBTemplate((byte[])dr["LIF"]); if (Util.Verify(sample, _template)) goto Found; } if (dr["LMF"] != DBNull.Value) { _template = Util.ProcessDBTemplate((byte[])dr["LMF"]); if (Util.Verify(sample, _template)) goto Found; } if (dr["LRF"] != DBNull.Value) { _template = Util.ProcessDBTemplate((byte[])dr["LRF"]); if (Util.Verify(sample, _template)) goto Found; } if (dr["LSF"] != DBNull.Value) { _template = Util.ProcessDBTemplate((byte[])dr["LSF"]); if (Util.Verify(sample, _template)) goto Found; } return false; } catch (Exception ex) { throw ex; } Found: return true; }
public void OnComplete(object Capture, string ReaderSerialNumber, DPFP.Sample Sample) { this.ReaderSerialNumber = ReaderSerialNumber; MakeReport("The fingerprint sample was captured."); SetPrompt("Scan the same fingerprint again."); this.Process(Sample); }
public virtual void Process(DPFP.Sample Sample) { if (this.SampleIndex > 3) this.SampleIndex = 3; this.Data.Samples[this.FingerPosition, this.SampleIndex] = Sample; DrawPicture(zsi.dtrs.Util.ConvertSampleToBitmap(Sample)); this.SampleIndex++; }
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 OnComplete(object Capture, string ReaderSerialNumber, DPFP.Sample Sample) { Process(Sample); }
public void OnSampleQuality(object Capture, string ReaderSerialNumber, DPFP.Capture.CaptureFeedback CaptureFeedback) { if (CaptureFeedback == DPFP.Capture.CaptureFeedback.Good) { } else { } }
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(); }
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; } } } }