[英]Fingerprint Image Binarization
我有一个指纹扫描仪应用程序,可以从设备中获取手指图像数据。
现在,我尝试对图像进行二值化。
我正在使用Otsu的算法对图像进行二值化处理,即像素的值为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;
}
但是生成的图像不是所需的输出。
谁能帮我这个忙。
大津法不适用于指纹图像。 尝试在下面使用此过滤器:
您将在这里找到: http : //code.google.com/p/catalano-framework/
例:
FastBitmap fb = new FastBitmap(bufferedImage);
fb.toGrayscale();
BradleyLocalThreshold b = new BradleyLocalThreshold();
b.applyInPlace(fb);
bufferedImage = fb.toBufferedImage();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.