protected virtual void Process(Sample Sample) { // Draw fingerprint sample image. DrawPicture(ConvertSampleToBitmap(Sample)); // Process the sample and create a feature set for the enrollment purpose. FeatureSet features = ExtractFeatures(Sample, DataPurpose.Enrollment); // Check quality of the sample and add to enroller if it's good if (features != null) { try { Enroller.AddFeatures(features); // Add feature set to template. } catch (SDKException ex) { MessageBox.Show("Error al capturar huella, intente de nuevo."); ResetFingerprint(); } }
public void OnComplete(object Capture, string ReaderSerialNumber, DPFP.Sample Sample) { FingerPrintScanner.DrawPicture(pic_left, FingerPrintScanner.ConvertSampleToBitmap(Sample)); try { FeatureSet feature = FingerPrintScanner.ExtractFeatures(Sample, DataPurpose.Enrollment); enroller.AddFeatures(feature); FingerPrintScanner.MakeReport(txtStatus, String.Format("Fingerprint samples needed: {0}", enroller.FeaturesNeeded)); switch (enroller.TemplateStatus) { case Enrollment.Status.Failed: FingerPrintScanner.MakeReport(txtStatus, String.Format("Fingerprint samples needed: {0}", enroller.FeaturesNeeded)); break; case Enrollment.Status.Insufficient: break; case Enrollment.Status.Ready: FingerPrintScanner.MakeReport(txtStatus, String.Format("Fingerprint samples needed: {0}", enroller.FeaturesNeeded)); capture.StopCapture(); FingerPrintScanner.MakeTemplate(enroller.Template, this); break; case Enrollment.Status.Unknown: FingerPrintScanner.MakeReport(txtStatus, String.Format("Fingerprint samples needed: {0}", enroller.FeaturesNeeded)); break; default: FingerPrintScanner.MakeReport(txtStatus, String.Format("Fingerprint samples needed: {0}", enroller.FeaturesNeeded)); break; } } catch (Exception) { FingerPrintScanner.MakeReport(txtStatus, String.Format("Fingerprint samples needed: {0}", enroller.FeaturesNeeded)); capture.StopCapture(); enroller.Clear(); capture.StartCapture(); } }
protected override void Process(Sample sample) { base.Process(sample); var features = ExtractFeatures(sample, DPFP.Processing.DataPurpose.Enrollment); // Check quality of the sample and add to enroller if it's good if (features == null) { return; } try { MakeReport("The fingerprint feature set was created."); _enroller.AddFeatures(features); // Add feature set to template. } finally { UpdateStatus(); switch (_enroller.TemplateStatus) { case Enrollment.Status.Ready: // report success and stop capturing SaveTemplate(_enroller.Template); TryClose(); break; case Enrollment.Status.Failed: // report failure and restart capturing _enroller.Clear(); Stop(); UpdateStatus(); //OnTemplate(null); Start(); break; } } }
/// <summary> /// Handle "Fingerprint reading Complete" event. /// If Enrollment (registration) is under process, consider the just-read sample as a new sample for the enrollment. /// Otherwise, save the sample as the "last read sample" in order to allow user to compare it with a fingerprints list. /// </summary> /// <param name="capture">Capture instance</param> /// <param name="info"></param> /// <param name="sample">Just-read fingerprint sample</param> public void OnComplete(object capture, string info, Sample sample) { if (!_registrationInProgress) // common authentication { // Notify that reading is complete. Suscriber has to confirm authentication by using DoesTemplateMatch method. _lastSample = sample; var args = new FingerprintReaderEventArgs(FingerprintReaderEventArgs.EventTypeValue.FPReaderReadingComplete); FireEvent(args); } else { try { _regFeatures[_fingerCount] = ExtractFeatures(sample, DataPurpose.Enrollment); if (_regFeatures[_fingerCount] == null) { return; } ++_fingerCount; _createRegTemplate.AddFeatures(_regFeatures[_fingerCount - 1]); if (_fingerCount <= FingerPressRequired) { FireEvent( new FingerprintReaderEventArgs(FingerprintReaderEventArgs.EventTypeValue.FPReaderFingerPress)); } if (_createRegTemplate.TemplateStatus == Enrollment.Status.Failed) { _fingerCount = 0; _registrationInProgress = false; _createRegTemplate.Clear(); FireEvent( new FingerprintReaderEventArgs( FingerprintReaderEventArgs.EventTypeValue.FPReaderRegistrationFailure)); } else { if (_createRegTemplate.TemplateStatus != Enrollment.Status.Ready) { return; } LastTemplate = _createRegTemplate.Template; _registrationInProgress = false; _fingerCount = 0; _createRegTemplate.Clear(); FireEvent( new FingerprintReaderEventArgs( FingerprintReaderEventArgs.EventTypeValue.FPReaderRegistrationSuccess)); } } catch (DPFP.Error.SDKException sdke) { if (sdke.ErrorCode == DPFP.Error.ErrorCodes.InvalidFeatureSet) { _registrationInProgress = false; _fingerCount = 0; _createRegTemplate.Clear(); FireEvent( new FingerprintReaderEventArgs( FingerprintReaderEventArgs.EventTypeValue.FPReaderRegistrationFailure)); } } } }