2

I am developing biometric attendance system. I am having problem in comparing the pixels of two fingerprints.

bmp1 = new Bitmap(pictureBox1.Image);
bmp2 = new Bitmap(pictureBox2.Image);

int wid = Math.Min(bmp1.Width, bmp2.Width);
int hgt = Math.Min(bmp1.Height, bmp2.Height);
Bitmap bmp3 = new Bitmap(wid, hgt);
//create the differences images
bool are_identical = true;
Color eq_color = Color.White;
Color ne_color = Color.Red;

for (int x = 0; x < wid; x++)
{
    for (int y = 0; y < hgt; y++)
    {
        if (bmp1.GetPixel(x, y).Equals(bmp2.GetPixel(x, y)))
        bmp3.SetPixel(x, y, eq_color);
        else
        {
            bmp3.SetPixel(x, y, ne_color);
            are_identical = false;
        }
    }
}

// Display the result.
pictureBox3.Image = bmp3;

this.Cursor = Cursors.Default;
if ((bmp1.Width != bmp2.Width) || (bmp1.Height != bmp2.Height)) are_identical = false;
if (are_identical)
    MessageBox.Show("The images are identical");
else
    MessageBox.Show("The images are different");
Camilo Terevinto
  • 31,141
  • 6
  • 88
  • 120
  • You might want to push that check, whether the dimensions match, up and don't even start the comparing loop, if they don't, for performance reasons. Other than that I can't figure what the problem is. Please provide some small sample images, the result you'd expect and the result you actually get with them. – sticky bit Apr 21 '18 at 16:44
  • 5
    Fingerprint images will rarely, if ever, be identical between scans. Dirt in the ridges, finger positioning, angle, slight color differences, etc. Doing pixel comparison is not going to work. – Ron Beyer Apr 21 '18 at 16:56
  • https://www.google.com/amp/s/www.androidauthority.com/how-fingerprint-scanners-work-670934/amp/ – Ron Beyer Apr 21 '18 at 17:03

1 Answers1

1

Fingerprint recognition doesn't work that way. Usually, those systems assess the unique features of the fingerprints rather than merely comparing image pixels. If you are doing it the right way, you will have to use a fingerprint recognition SDK.

However, if you need to compare two images you can do it by using an image processing library such as emgucv.

Again, there are endless ways to do the image comparison. One simple way to do this is by using histogram comparison. emgucv comes up with cvCompareHist method which can be used for histogram comparison.

  • Check these links, [here](https://stackoverflow.com/questions/14133215/is-there-any-free-fingerprint-identification-sdk-available-in-net) and [here](http://www.emgu.com/forum/viewtopic.php?t=2956) – Dineth Cooray Apr 21 '18 at 17:16