我已经在java中实现了脊线方向的代码。我已经制作了16 * 16的块并获得了每个块的方向角。
我已实施代码以获取方向角:
public static double angle(int i,int j,int[][] pixel){
double angle = 0;
double num = 0;
double denom =0;
for(int x=i;x<i+16;x++){
for(int y=j;y<j+16;y++){
try {
int gx = sobelOperatorX(i, j, pixel);
int gy = sobelOperatorY(i, j, pixel);
num += (2 * gx * gy);
denom +=((gx * gx) - (gy * gy));
} catch (Exception e) {
// TODO: handle exception
}
}
}
angle = 0.5 * Math.atan(num/denom);
return angle;
}
public static int sobelOperatorX(int x,int y,int[][] pixel){
int k=2;
int Gx=0;
Gx = (((pixel[x+1][y-1]+k*pixel[x+1][y]+pixel[x+1][y+1])-(pixel[x-1][y-1]+k*pixel[x-1][y]+pixel[x-1][y+1]))/(k+2));
return Gx;
}
public static int sobelOperatorY(int x,int y,int[][] pixel){
int k=2;
int Gy=0;
Gy = (((pixel[x-1][y-1]+k*pixel[x][y-1]+pixel[x+1][y-1])-(pixel[x-1][y+1]+k*pixel[x][y+1]+pixel[x+1][y+1]))/(k+2));
return Gy;
}
现在我正在尝试获取orientation map指纹图像。输出图像应如下所示:
是否有任何算法可以找出脊的方向或获得指纹图像的方向图?