我有数字Persona指纹读取器,我想要做的是在目录中的捕获事件上保存指纹并在picturebox
中显示它。下面的代码正在picturebox
中显示,但如何在扩展名为.fpt的目录中保存DPFP.sample
捕获事件。
Imports System.IO
Public Class EnrollmentForm
Implements DPFP.Capture.EventHandler
Public Data As AppData
Public Capturer As DPFP.Capture.Capture = New DPFP.Capture.Capture()
Private Enroller As DPFP.Processing.Enrollment = New DPFP.Processing.Enrollment()
Private Sub EnrollmentForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ListEvents.Items.Clear()
System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = False
If (Not Capturer Is Nothing) Then
Capturer.EventHandler = Me
Capturer.StartCapture()
End If
End Sub
Sub OnComplete(ByVal Capture As Object, ByVal ReaderSerialNumber As String, ByVal Sample As DPFP.Sample) Implements DPFP.Capture.EventHandler.OnComplete
ListEvents.Items.Add("The fingerprint sample was captured.")
PictureBox1.Image = Nothing
PictureBox1.Image = New Bitmap(ConvertSampleToBitmap(Sample), PictureBox1.Size)
TextBox1.Text = Val(TextBox1.Text) + 1
If Not PictureBox1.Image Is Nothing And TextBox1.Text = "4" Then
MsgBox("Your Finger is Registered, Ready for Verification", MsgBoxStyle.Information, "Fingerprint Enrollment")
End If
End Sub
Sub OnFingerGone(ByVal Capture As Object, ByVal ReaderSerialNumber As String) Implements DPFP.Capture.EventHandler.OnFingerGone
ListEvents.Items.Add("The fingerprint reader was Removed.")
End Sub
Sub OnFingerTouch(ByVal Capture As Object, ByVal ReaderSerialNumber As String) Implements DPFP.Capture.EventHandler.OnFingerTouch
ListEvents.Items.Add("The fingerprint reader was touched.")
End Sub
Sub OnReaderConnect(ByVal Capture As Object, ByVal ReaderSerialNumber As String) Implements DPFP.Capture.EventHandler.OnReaderConnect
ListEvents.Items.Add("The fingerprint reader was connected.")
End Sub
Sub OnReaderDisconnect(ByVal Capture As Object, ByVal ReaderSerialNumber As String) Implements DPFP.Capture.EventHandler.OnReaderDisconnect
ListEvents.Items.Add("The fingerprint reader was Disconnected.")
End Sub
Sub OnSampleQuality(ByVal Capture As Object, ByVal ReaderSerialNumber As String, ByVal CaptureFeedback As DPFP.Capture.CaptureFeedback) Implements DPFP.Capture.EventHandler.OnSampleQuality
ListEvents.Items.Add("The quality of the fingerprint sample is good.")
End Sub
'--------------------------------------------------------------------------------------------
Protected Function ConvertSampleToBitmap(ByVal Sample As DPFP.Sample) As Bitmap
Dim convertor As New DPFP.Capture.SampleConversion() ' Create a sample convertor.
Dim bitmap As Bitmap = Nothing ' TODO: the size doesn't matter
convertor.ConvertToPicture(Sample, bitmap) ' TODO: return bitmap as a result
Return bitmap
End Function
End Class