【问题标题】:Fingerprint scanning with DigitalPersona 4500 reader. How to get captured image and loading events handlers使用 DigitalPersona 4500 读取器进行指纹扫描。如何获取捕获的图像和加载事件处理程序
【发布时间】:2017-08-03 20:18:45
【问题描述】:

我不熟悉在 C# 中使用生物识别传感器和 DLL 进行编码。我正在使用 DigitalPersona 阅读器 UareU 4500。我已经阅读了 API 文档并看到了他们提供的示例程序。但是,我对使用 GUI 版本不感兴趣。我想使用 API 方法。我已经搜索了示例,但找不到任何描述性的示例。请帮忙。

我的问题是如何设置加载事件处理程序以及如何获取位图图像中的指纹。

提前谢谢你。任何信息或指南都非常感谢。

class FingerprintScanning
{
    public DPFP.Capture.Capture fingerprint = new DPFP.Capture.Capture();
    public DPFP.Sample sample = new DPFP.Sample();
    public DPFP.Capture.EventHandler EventHandler;
    public Bitmap picture_result = null;


    public void CaptureFingerprint()
    {
        fingerprint.StartCapture();

        //Events
     EventHandler.OnFingerTouch(fingerprint,fingerprint.ReaderSerialNumber);
 EventHandler.OnComplete(fingerprint,fingerprint.ReaderSerialNumber,sample);

        //Convert to Bitmap
        SampleConversion image = new SampleConversion();
        image.ConvertToPicture(sample, ref picture_result);
        fingerprint.StopCapture();

    }

}

【问题讨论】:

    标签: c# fingerprint biometrics fingerprinting


    【解决方案1】:

    我找到了使用 SDK API 的示例。在这里分享,以防有人需要在类似的项目中实施。

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    
    namespace Enrollment
    {
    /* NOTE: This form is a base for the EnrollmentForm and the VerificationForm,
        All changes in the CaptureForm will be reflected in all its derived forms.
    */
    public partial class CaptureForm : Form, DPFP.Capture.EventHandler
    {
        public CaptureForm()
        {
            InitializeComponent();
        }
    
        protected virtual void Init()
        {
            try
            {
                Capturer = new DPFP.Capture.Capture();              // Create a capture operation.
    
                if ( null != Capturer )
                    Capturer.EventHandler = this;                   // Subscribe for capturing events.
                else
                    SetPrompt("Can't initiate capture operation!");
            }
            catch
            {               
                MessageBox.Show("Can't initiate capture operation!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);            
            }
        }
    
        protected virtual void Process(DPFP.Sample Sample)
        {
            // Draw fingerprint sample image.
            DrawPicture(ConvertSampleToBitmap(Sample));
        }
    
        protected void Start()
        {
            if (null != Capturer)
            {
                try
                {
                    Capturer.StartCapture();
                    SetPrompt("Using the fingerprint reader, scan your fingerprint.");
                }
                catch
                {
                    SetPrompt("Can't initiate capture!");
                }
            }
        }
    
        protected void Stop()
        {
            if (null != Capturer)
            {
                try
                {
                    Capturer.StopCapture();
                }
                catch
                {
                    SetPrompt("Can't terminate capture!");
                }
            }
        }
    
    #region Form Event Handlers:
    
        private void CaptureForm_Load(object sender, EventArgs e)
        {
            Init();
            Start();                                                // Start capture operation.
        }
    
        private void CaptureForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            Stop();
        }
    #endregion
    
    #region EventHandler Members:
    
        public void OnComplete(object Capture, string ReaderSerialNumber, DPFP.Sample Sample)
        {
            MakeReport("The fingerprint sample was captured.");
            SetPrompt("Scan the same fingerprint again.");
            Process(Sample);
        }
    
        public void OnFingerGone(object Capture, string ReaderSerialNumber)
        {
            MakeReport("The finger was removed from the fingerprint reader.");
        }
    
        public void OnFingerTouch(object Capture, string ReaderSerialNumber)
        {
            MakeReport("The fingerprint reader was touched.");
        }
    
        public void OnReaderConnect(object Capture, string ReaderSerialNumber)
        {
            MakeReport("The fingerprint reader was connected.");
        }
    
        public void OnReaderDisconnect(object Capture, string ReaderSerialNumber)
        {
            MakeReport("The fingerprint reader was disconnected.");
        }
    
        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.");
        }
    #endregion
    
        protected 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;
        }
    
        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;
        }
    
        protected void SetStatus(string status)
        {
            this.Invoke(new Function(delegate() {
                StatusLine.Text = status;
            }));
        }
    
        protected void SetPrompt(string prompt)
        {
            this.Invoke(new Function(delegate() {
                Prompt.Text = prompt;
            }));
        }
        protected void MakeReport(string message)
        {
            this.Invoke(new Function(delegate() {
                StatusText.AppendText(message + "\r\n");
            }));
        }
    
        private void DrawPicture(Bitmap bitmap)
        {
            this.Invoke(new Function(delegate() {
            Picture.Image = new Bitmap(bitmap, Picture.Size);   // fit the image 
    into the picture box
                }));
            }
    
            private DPFP.Capture.Capture Capturer;
    
        }
    }
    

    【讨论】:

    • 可以分享一下你用的sdk吗?
    • 嗨@Smith,我使用了DigitalPersona One Touch For Windows SDK .NET Edition。 1.6 版。希望对您有所帮助。
    • 请问我在哪里可以获得 SDK 的免费版本或试用版。
    • @Smith SDK 随购买设备或 SDK 软件提供。我不知道他们是否提供试用版或免费版。我建议您访问 Crossmatch 的网站并加入他们的开发者门户网站以查找有关它的更多信息。这是链接:devportal.digitalpersona.com
    • @Smith 检查这个 repo...也许你可以(咳咳)downl ....d 它github.com/iamonuwa/Digital-Persona-SDK
    猜你喜欢
    • 2020-09-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-14
    相关资源
    最近更新 更多