Question

I have an finger print scanner application which takes finger image data from device.

Now I am trying to binarize the image.

I am Using the Otsu's algorithm to binarize the image i.e. pixel's values either 0 or 255.

Threshold is calculated around 160 using same algorithm. Here is my code:

public static byte[][] binarizeImage(BufferedImage bfImage){
    final int THRESHOLD = 160;
    int height = bfImage.getHeight();
    int width = bfImage.getWidth();
    byte[][] image = new byte[width][height];

    for(int i=0; i<width; i++){
        for(int j=0; j<height; j++){
            Color c = new Color(bfImage.getRGB(i,j));
            int red = c.getRed();
            int green = c.getGreen();
            int blue = c.getBlue();
            if(red<THRESHOLD && green<THRESHOLD && blue<THRESHOLD){
                image[i][j] = 1;
            }else{
                image[i][j] = 0;
            }
        }
    }
    return image;
}

But the resulting image is not of the desired output.

enter image description here

Could anyone help me with this.

Was it helpful?

Solution

Otsu method isn't good for fingerprint images. Try to use this filters below:

  • Bradley Local Threshold
  • Bernsen Threshold.
  • Maximum Entropy Threshold.

You will find here: http://code.google.com/p/catalano-framework/

Example:

FastBitmap fb = new FastBitmap(bufferedImage);
fb.toGrayscale();

BradleyLocalThreshold b = new BradleyLocalThreshold();
b.applyInPlace(fb);

bufferedImage = fb.toBufferedImage();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top