Esempio n. 1
0
 private void scanner_ImageScanned(object sender, FPScannerImageScannedEventArgs ea)
 {
     OnImage((NGrayscaleImage)ea.Image.Clone());
 }
Esempio n. 2
0
        private void Scanner_ImageScanned(object sender, FPScannerImageScannedEventArgs ea)
        {
            //the lock is used to prevent a race condition
            //if a template is captured, capturing is set to false
            //a new call to StartCapturing is required in order to get the next template
            lock (_locker)
            {
                if (_isCapturing)
                {
                    NfeExtractionStatus status;
                    Template template = null;
                    try
                    {
                        NFExtractor extractor = new NFExtractor();
                        NFRecord record = extractor.Extract(ea.Image, NFPosition.Unknown, NFImpressionType.LiveScanPlain, out status);
                        template = new Template(record.Save(), record.Minutiae.Count);
                        extractor.Dispose();
                    }
                    catch (Exception ex)
                    {
                        OnTemplateCaptured(new TemplateCapturedEventArgs(template, TemplateCapturedStatus.ExtractorException));
                        return;
                    }

                    if (status == NfeExtractionStatus.QualityCheckFailed)
                    {
                        OnTemplateCaptured(new TemplateCapturedEventArgs(template, TemplateCapturedStatus.QualityCheckFailed));
                        return;
                    }

                    if (status == NfeExtractionStatus.TooFewMinutiae)
                    {
                        OnTemplateCaptured(new TemplateCapturedEventArgs(template, TemplateCapturedStatus.MinutiaCountFailed));
                        return;
                    }

                    OnTemplateCaptured(new TemplateCapturedEventArgs(template, TemplateCapturedStatus.Success));
                }
            }
        }