public int LoadFingerprintTemplates(string[] templates) { if (myFinger == null) { return(-1); } myFinger.SetTextBox("Request LoadFingerPrint :" + templates.Length, DateTime.Now); myFinger.UserList.Clear(); foreach (string data in templates) { if (data != null) { try { UserClass TheUser = new UserClass(); BinaryFormatter bf = new BinaryFormatter(); MemoryStream mem = new MemoryStream(Convert.FromBase64String(data)); TheUser = (UserClass)bf.Deserialize(mem); myFinger.UserList.Add(TheUser); int enrolledFinger = 0; for (int j = 0; j < TheUser.strFingerprint.Length; j++) { if (TheUser.strFingerprint[j] != null) { enrolledFinger++; } } myFinger.SetTextBox("Find :" + TheUser.firstName + " " + TheUser.lastName + " with " + enrolledFinger.ToString() + " enrolled finger(s) ", DateTime.Now); for (int i = 0; i < TheUser.strFingerprint.Length; i++) { if (TheUser.strFingerprint[i] != null) { FingerIndexValue fiv = (FingerIndexValue)i; myFinger.SetTextBox("Load :" + TheUser.firstName + " " + TheUser.lastName + " : " + fiv.ToString(), DateTime.Now); } } } catch (Exception exp) { string err = "Error during Deserialization : " + exp.Message; myFinger.SetTextBox(err + "\r\nFailed template : " + data, DateTime.Now); } } else { myFinger.SetTextBox("try to Load null template", DateTime.Now); } } myFinger.SetTextBox(myFinger.UserList.Count + " Templates loaded", DateTime.Now); return(myFinger.UserList.Count); }
protected virtual void Process(DPFP.Sample Sample) { if (Mode == FingerprintMode.Verify) { bool bVerified = false; int fingerFind = -1; UserClass VerifiedUser = new UserClass(); // Process the sample and create a feature set for the enrollment purpose. DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification); if (features != null) { foreach (UserClass TheUser in UserList) { FingerData fingdata = new FingerData(); fingdata.CopyUserToFinger(TheUser); //foreach (DPFP.Template Template in fingdata.Templates) for (int index = 0; index < 10; index++) { DPFP.Template Template = fingdata.Templates[index]; if (Template != null) { FingerIndexValue fiv = (FingerIndexValue)index; // Compare the feature set with our template DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result(); Verificator.Verify(features, Template, ref result); SetTextBox("Verify : " + TheUser.firstName + " " + TheUser.lastName + " : " + fiv.ToString() + " - FAR :" + result.FARAchieved.ToString() + " / " + Verificator.FARRequested.ToString() + " - Verified : " + result.Verified.ToString(), DateTime.Now); if (CloseFarFinger > result.FARAchieved) { CloseFarFinger = result.FARAchieved; } if ((result.Verified) || (result.FARAchieved < Verificator.FARRequested)) { bVerified = true; VerifiedUser = TheUser; fingerFind = index; break; } } } if (bVerified) { break; } } if (bVerified) { string strUser = VerifiedUser.firstName + ";" + VerifiedUser.lastName + ";" + fingerFind.ToString(); debugFirstName = VerifiedUser.firstName; debugLastName = VerifiedUser.lastName; debugFinger = (FingerIndexValue)fingerFind; if (debugOnFailedOnly) { errorCaptFP = false; } notifyEvent = new FingerArgs(ReaderSerialNumber, FingerArgs.FingerNotify.RN_AuthentificationCompleted, strUser); if (NotifyEvent != null) { SetTextBox("User verify : " + strUser, DateTime.Now); NotifyEvent(this, notifyEvent); } } else { debugFirstName = "Unknown User"; debugLastName = "Unknown User"; debugFinger = FingerIndexValue.Unknown_Finger; notifyEvent = new FingerArgs(ReaderSerialNumber, FingerArgs.FingerNotify.RN_FingerUserUnknown, "Unknown User"); if (NotifyEvent != null) { SetTextBox("Unknown User", DateTime.Now); NotifyEvent(this, notifyEvent); } } } } }
public DebugFP( bool FormVisible, int timeout, bool sendMail, Bitmap BmpFP, string reader, DateTime TimeFingerTouch, DateTime TimeFingerGone, string debugFirstName, string debugLastName, FingerIndexValue debugFinger, int FarAchieved, int FarThreshold, DPFP.Capture.CaptureFeedback debugFeedback, string pathImage, bool bIsProcessed, string SenderAdress, string LoginName, string Password, string SMTPServer, int SMTPPort ) { InitializeComponent(); this.FormVisible = FormVisible; this.timeout = timeout; this.sendMail = sendMail; timer1.Interval = timeout * 1000; this.BmpFP = BmpFP; if (this.BmpFP != null) { pictureBoxFP.Image = new Bitmap(this.BmpFP, pictureBoxFP.Size); } //pictureBoxFP.Image = cleanBitmap(this.BmpFP); this.SenderAdress = SenderAdress; this.LoginName = LoginName; this.Password = Password; this.SMTPServer = SMTPServer; this.SMTPPort = SMTPPort; this.reader = reader; labelReader.Text = "Reader S/N : " + this.reader; this.TimeFingerGone = TimeFingerGone; this.TimeFingerTouch = TimeFingerTouch; labelTouch.Text = "Touch : " + TimeFingerTouch.ToString("G") + TimeFingerTouch.ToString(":fff"); labelGone.Text = "Gone :" + TimeFingerGone.ToString("G") + TimeFingerGone.ToString(":fff");; TimeSpan ts = TimeFingerGone - TimeFingerTouch; labelElapsed.Text = "Time Sensor :" + ts.TotalSeconds.ToString("0.000") + " sec"; this.debugFirstName = debugFirstName; this.debugLastName = debugLastName; this.debugFinger = debugFinger; labelFirsname.Text = "First Name : " + debugFirstName; labelLastName.Text = "Last Name : " + debugLastName; labelFinger.Text = "Finger Used : " + debugFinger.ToString(); this.FarAchieved = FarAchieved; this.FarThreshold = FarThreshold; labelFAR.Text = "FAR : " + FarAchieved.ToString() + " / " + FarThreshold.ToString(); this.debugFeedback = debugFeedback; labelQuality.Text = "Quality : " + debugFeedback.ToString(); this.pathImage = pathImage; this.bIsProcessed = bIsProcessed; if (bIsProcessed) { labelCapture.Text = "Capture Status : OK"; } else { labelCapture.Text = "Capture Status : not OK"; } if (!FormVisible) { this.Opacity = 0.0f; this.WindowState = FormWindowState.Minimized; this.ShowInTaskbar = false; } else { this.BackColor = Color.WhiteSmoke; } }