I am developing a vb.net 2008 application that should verify one's fingerprint from the scanner and the one from the database.
When I input an ID it's returning the fingerprint of that person from the database. Then how do I compare the two fingerprints images, one from the scanner and the one in the picturebox?
I am using this code but it's not giving me results.
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 `
I will be grateful if any one helps me with this. Thanks for your attention.