每当我扫描指纹进行验证时,即使我已将指纹登记到数据库中,我也会收到“指纹未经验证”的消息。以下是表单加载时捕获的代码
以下是表单加载时的捕获代码
Private Sub Me_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Init()
StartCapture()
Dim conn As New MySqlConnection
Dim cmd As New MySqlCommand
Dim sql As String
conn.ConnectionString = "**** "
conn.Open()
sql = ("SELECT * FROM new_case_file")
cmd.Connection = conn
cmd.CommandText = sql
Dim rdr As MySqlDataReader = cmd.ExecuteReader()
While (rdr.Read())
Dim MemStream As IO.MemoryStream
Dim fpBytes As Byte()
fpBytes = rdr("FingerPrint")
MemStream = New IO.MemoryStream(fpBytes)
Dim templa8 As DPFP.Template = New DPFP.Template()
templa8.DeSerialize(MemStream)
Dim serializedTemplate As Byte() = MemStream.ToArray
Dim tmpObj As New AppData
Dim FPList As List(Of AppData) = New List(Of AppData)
'tmpObj.No = rdr("No").ToString()
'tmpObj.Template = templa8
'FPList.Add(tmpObj)
End While
conn.Close()
End Sub
以下是验证码。当我点击按钮时,它应该验证,因为我在按钮点击子中调用了子verifyControl_Commplete
。
Private Sub verifyControl_OnComplete(ByVal Control As Object, ByVal FeatureSet As DPFP.FeatureSet, ByRef EventHandlerStatus As
DPFP.Gui.EventHandlerStatus) Handles verifyControl.OnComplete
Dim printFound As Boolean = False
'Dim printFound As Boolean = True
'Dim printFound As Boolean = False
Dim VerifiedFPData = New AppData
Dim FPList As List(Of AppData) = New List(Of AppData)
Try
For Each FPData As AppData In FPList
Dim tmplateData As New DPFP.Template
'tmplateData = FPData.Template
Dim compareTo As New DPFP.FeatureSet
compareTo = FeatureSet
Dim ver As New DPFP.Verification.Verification()
Dim res As New DPFP.Verification.Verification.Result()
If Not tmplateData Is Nothing Then
ver.Verify(FeatureSet, tmplateData, res)
If res.Verified Then
EventHandlerStatus = DPFP.Gui.EventHandlerStatus.Success
printFound = True
VerifiedFPData = FPData
Exit For
End If
End If
Next
Catch ex As Exception
MessageBox.Show("Error")
End Try
If printFound Then
MsgBox("Verified")
Else
EventHandlerStatus = DPFP.Gui.EventHandlerStatus.Failure
MsgBox("Not Verified")
End If
End Sub
Private Sub btnverifyfp_Click(sender As Object, e As EventArgs) Handles btnverifyfp.Click
verifyControl_OnComplete(Nothing, Nothing, Nothing)
End Sub
这是用于保存指纹的代码
Dim fingerprintData As MemoryStream = New MemoryStream
Enroller.Template.Serialize(fingerprintData)
Dim serializedTemplate As Byte() = fingerprintData.ToArray()
Dim bytes() As Byte = serializedTemplate
答案 0 :(得分:0)
试试这个:
'THIS NEEDS TO BE AT THE CLASS-LEVEL, AS A MEMBER
Private FPList As New List(Of AppData)
Private Sub Me_Load(ByVal sender As System.Object, ByVal e AsSystem.EventArgs)
Handles MyBase.Load
Init()
StartCapture()
Dim sql As String = "SELECT * FROM new_case_file"
Using conn As New MySqlConnection("**** "), _
cmd As New MySqlCommand(sql, conn)
conn.Open()
Using rdr As MySqlDataReader = cmd.ExecuteReader()
FPList.Clear()
While (rdr.Read())
Dim tmpObj As New AppData
tmpObj.No = rdr("No").ToString()
Dim fpBytes As Byte() = rdr("FingerPrint")
Using MemStream As New IO.MemoryStream(fpBytes)
Dim templa8 As New DPFP.Template()
templa8.DeSerialize(MemStream)
End Using
tmpObj.Template = templa8
FPList.Add(tmpObj)
End While
rdr.Close()
End Using
End Using
End Sub
现在其他代码可以使用相同的FPList
变量。如果您发现自己在其他地方写了New List(Of AppData)
,那么您就会做错事。
AppData
类看起来像这样:
Public Class AppData
Public Property No As String
Public Property Template As DFFP.Template
End Class
最后,验证码:
Private Sub verifyControl_OnComplete(ByVal Control As Object, ByVal FeatureSet As DPFP.FeatureSet,
ByRef EventHandlerStatus As DPFP.Gui.EventHandlerStatus)
Handles verifyControl.OnComplete
Try
Dim ver As New DPFP.Verification.Verification()
Dim res As New DPFP.Verification.Verification.Result()
For Each FPData As AppData In FPList
If FPData.Template Is Nothing Then Continue
ver.Verify(FeatureSet, FPData.Template, res)
If res.Verified Then
EventHandlerStatus = DPFP.Gui.EventHandlerStatus.Success
MsgBox("Verified")
Return
End If
Next FPDAta
Catch ex As Exception
MessageBox.Show("Error")
End Try
EventHandlerStatus = DPFP.Gui.EventHandlerStatus.Failure
MsgBox("Not Verified")
End Sub
再次......我们无法访问您的API文档,测试数据或设备。这意味着我们在这里试图帮助你。这可能有些问题,你必须能够进行故障排除和调试。