指纹图像二值化

时间:2013-08-30 08:52:04

标签: java image-processing fingerprint

我有一个指纹扫描仪应用程序,它从设备中获取手指图像数据。

现在我正在尝试将图像二值化。

我正在使用Otsu's algorithm对图像进行二值化,即像素的值为0或255.

使用相同的算法计算阈值大约160。 这是我的代码:

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;
}

但是生成的图像不是所需的输出。

enter image description here

任何人都可以帮我解决这个问题。

1 个答案:

答案 0 :(得分:1)

Otsu方法对指纹图像不利。尝试使用以下过滤器:

  • 布拉德利本地门槛
  • Bernsen Threshold。
  • 最大熵阈值。

你会在这里找到:http://code.google.com/p/catalano-framework/

示例:

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

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

bufferedImage = fb.toBufferedImage();
相关问题