You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在VB中正确从MariaDB检索DigitalPersona指纹数据

DigitalPersona U 3.2.0指纹识别:无法从MariaDB检索已保存指纹数据

我使用DigitalPersona(版本U 3.2.0)开发生物识别功能,目前遇到无法从MariaDB数据库中检索已保存指纹数据的问题。我确认数据格式为ANSI,但不确定指纹数据存入数据库的流程是否正确。尝试将格式从ANSI改为ISO后,问题仍未解决。

注册表单代码

Public Sub OnCaptured(ByVal captureResult As CaptureResult)
    Try
        ' Check capture quality and throw an error if bad.
        If Not _sender.CheckCaptureResult(captureResult) Then Return

        count += 1

        ' Create the FMD from the captured fingerprint
        Dim resultConversion As DataResult(Of Fmd) = FeatureExtraction.CreateFmdFromFid(captureResult.Data, Formats.Fmd.ANSI)

        If resultConversion.ResultCode <> Constants.ResultCode.DP_SUCCESS Then
            _sender.Reset = True
            Throw New Exception("" & resultConversion.ResultCode.ToString())
        End If

        ' Add the FMD to the preenrollment list
        preenrollmentFmds.Add(resultConversion.Data)

        SendMessage(Action.SendMessage, "A finger was captured.  " & vbCrLf & "Count:  " & (count.ToString()))

        If count >= 4 Then
            ' Convert list to array of FMDs before calling CreateEnrollmentFmd
            Dim enrolledFmdArray As Fmd() = preenrollmentFmds.ToArray()

            ' Create an Enrollment FMD
            Dim resultEnrollment As DataResult(Of Fmd) = DPUruNet.Enrollment.CreateEnrollmentFmd(Formats.Fmd.ANSI, enrolledFmdArray)

            If resultEnrollment.ResultCode = ResultCode.DP_SUCCESS Then
                SendMessage(Action.SendMessage, "An enrollment FMD was successfully created.")
                SendMessage(Action.SendMessage, "Place a finger on the reader.")

                ' Save the enrollment FMD to the database
                SaveFingerprintToDatabase(resultEnrollment.Data)

                count = 0
                preenrollmentFmds.Clear()
                Return
            ElseIf (resultEnrollment.ResultCode = Constants.ResultCode.DP_ENROLLMENT_INVALID_SET) Then
                SendMessage(Action.SendMessage, "Enrollment was unsuccessful.  Please try again.")
                SendMessage(Action.SendMessage, "Place a finger on the reader.")
                count = 0
                preenrollmentFmds.Clear()
                Return
            End If
        End If

        SendMessage(Action.SendMessage, "Now place the same finger on the reader.")
    Catch ex As Exception
        SendMessage(Action.SendMessage, "Error:  " & ex.Message)
    End Try
End Sub

识别表单代码

Public Sub OnCaptured(ByVal captureResult As CaptureResult)
    Try
        ' Check capture quality and throw an error if bad.
        If Not _sender.CheckCaptureResult(captureResult) Then Return

        SendMessage(Action.SendMessage, "A finger was captured.")

        ' Create the FMD from the captured fingerprint
        Dim resultConversion As DataResult(Of Fmd) = FeatureExtraction.CreateFmdFromFid(captureResult.Data, Formats.Fmd.ANSI)

        If resultConversion.ResultCode <> Constants.ResultCode.DP_SUCCESS Then
            If resultConversion.ResultCode <> Constants.ResultCode.DP_TOO_SMALL_AREA Then
                _sender.Reset = True
            End If
            Throw New Exception("" & resultConversion.ResultCode.ToString())
        End If

        ' Retrieve the enrolled FMDs from the database
        Dim enrolledFmds As List(Of Fmd) = GetEnrolledFmdsFromDatabase()

        If enrolledFmds.Count > 0 Then
            ' Convert List to Array for comparison
            Dim enrolledFmdArray As Fmd() = enrolledFmds.ToArray()

            ' Set the threshold score (adjust as needed)
            Dim thresholdScore As Integer = DPFJ_PROBABILITY_ONE * 1 / 1000

            ' Use Identify function for comparison (returns an array of matching candidates)
            Dim identifyResult As IdentifyResult = Comparison.Identify(resultConversion.Data, 0, enrolledFmdArray, thresholdScore, 5)

            If identifyResult.ResultCode = Constants.ResultCode.DP_SUCCESS Then
                If identifyResult.Indexes.Length > 0 Then
                    ' Match found
                    SendMessage(Action.SendMessage, "Fingerprint matched with an enrolled FMD!")
                Else
                    SendMessage(Action.SendMessage, "No match found in the database.")
                End If
            Else
                SendMessage(Action.SendMessage, "Error during identification: " & identifyResult.ResultCode.ToString())
            End If
        Else
            SendMessage(Action.SendMessage, "No enrolled fingerprints found in the database.")
        End If

        ' Reset for the next capture
        count = 0
    Catch ex As Exception
        SendMessage(Action.SendMessage, "Error: " & ex.Message)
    End Try
End Sub

内容的提问来源于stack exchange,提问作者Clar Estorninos

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 13:45:11