使用ZK7000 USB指纹扫描仪进行指纹验证

时间:2013-05-05 17:31:57

标签: vb.net ms-access

我正在开发一个vb.net 2008应用程序,它应该从扫描程序和数据库中的指纹验证一个人的指纹。

当我输入ID时,它会从数据库中返回该人的指纹。那么如何比较两个指纹图像,一个来自扫描仪,一个来自图片框?

我正在使用此代码,但它没有给我结果。

Sub compare_6()
    Me.Cursor = Cursors.WaitCursor
    Application.DoEvents()

    ' Get the threshold.
    Dim threshold As Integer = Integer.Parse(txtThreshold.Text)

    ' Load the images.

    Dim bm1 As Bitmap = PictureBox1.Image
    Dim bm2 As Bitmap = PictureBox2.Image

    ' Make a difference image.
    Dim wid As Integer = Math.Min(bm1.Width, bm2.Width)
    Dim hgt As Integer = Math.Min(bm1.Height, bm2.Height)
    Dim bm3 As New Bitmap(wid, hgt)

    ' Create the difference image.
    Dim are_identical As Boolean = True
    '  Dim r1, g1, b1, r2, g2, b2, r3, g3, b3 As Integer
    Dim color1, color2 As Color
    Dim eq_color As Color = Color.White
    Dim ne_color As Color = Color.Red
    Dim dr, dg, db, diff As Integer
    For x As Integer = 0 To wid - 1
        For y As Integer = 0 To hgt - 1
            color1 = bm1.GetPixel(x, y)
            color2 = bm2.GetPixel(x, y)
            dr = CInt(color1.R) - color2.R
            dg = CInt(color1.G) - color2.G
            db = CInt(color1.B) - color2.B
            '
            diff = dr * dr + dg * dg + db * db
            If diff <= threshold Then
                bm3.SetPixel(x, y, eq_color)
            Else
                bm3.SetPixel(x, y, ne_color)
                are_identical = False
            End If
        Next y
    Next x

    ' Display the result.
    picResult.Image = bm3

    Me.Cursor = Cursors.Default
    If (bm1.Width <> bm2.Width) OrElse (bm1.Height <> bm2.Height) Then are_identical = False
    If are_identical Then
        MessageBox.Show("The images are identical")
        Exit Sub
    Else
        MessageBox.Show("The images are different")
        Exit Sub
    End If

    bm1.Dispose()
    bm2.Dispose()
End Sub      ` 

如果有人帮助我,我将不胜感激。谢谢你的关注。

1 个答案:

答案 0 :(得分:2)

你永远不会得到相同的图像。您无法获得2次精确扫描。有两种类型的指纹验证。 点,您在哪里寻找指纹中的脊的交叉点。 模式,使用模式识别算法。这要困难得多,但会产生更好的效果,尤其是部分打印时。

您需要做的是忘记重新发明轮子并合并第三方软件模块,进行比较并将结果返回给您。

谷歌指纹比较软件。结果有370万。 Here's one that's written in C++, and includes the source code.祝你好运。