Beispiel #1
0
 void FPCore_onImage(object source, GriauleFingerprintLibrary.Events.ImageEventArgs ie)
 {
     try
     {
         if (ie.RawImage != null)
         {
             SetImage(ie.RawImage.Image);
             template = new FingerprintTemplate();
             int ret = (int)FPCore.Enroll(ie.RawImage, ref template, (GrTemplateFormat)Controller.DefaultTemplateFormat, FingerprintConstants.GR_DEFAULT_CONTEXT);
             if (ret >= FingerprintConstants.GR_ENROLL_SUFFICIENT)
             {
                 DisplayImage(template, ie.RawImage);
                 EnableCaptureButton(true);
                 if (ret == FingerprintConstants.GR_ENROLL_SUFFICIENT)
                 {
                     ShowQuality(EnrollQuality.Sufficient);
                     SetFingerLabel("Place finger again to improve quality", true);
                 }
                 else if (ret == FingerprintConstants.GR_ENROLL_GOOD)
                 {
                     ShowQuality(EnrollQuality.Good);
                     SetFingerLabel("Click 'Capture' to record template", true);
                 }
                 else if (ret == FingerprintConstants.GR_ENROLL_VERY_GOOD)
                 {
                     ShowQuality(EnrollQuality.VeryGood);
                     SetFingerLabel("Click 'Capture' to record template", true);
                 }
                 else if (ret == FingerprintConstants.GR_ENROLL_MAX_LIMIT_REACHED)
                 {
                     SetFingerLabel("Enrollment limit reached", true);
                 }
             }
             else
             {
                 SetFingerLabel("Place finger again", true);
                 ShowQuality(EnrollQuality.Poor);
             }
             Thread.Sleep(100);
         }
     }
     catch (FingerprintException ex)
     {
         ShowFPError(ex);
     }
     catch (Exception e)
     {
         ShowError(e);
     }
 }