I am working on latent methods to improve finger quality. during implementation, I split the images of 16X16 blocks, and then got a 32x16 oriented window for each pixel (i, j) and computes the x-signature for each block center at (i, j) now I'm stuck at the point where I need to calculate the average pixels at two consecutive peaks in the x signature, but how? i have been googling from the last two days but got no solution?
This is the image that I work.

which I divided into 16X16 blocks for further work
The following image is for a oriented window.

this is the local ridge orientation formula for (i, j) that I calculated in the code below

x- (i, j),
)

, T (i, j)
T (i, j) - x-signature
Java, ,
public static BufferedImage[] getOrientedBlocks(BufferedImage[] blocks16x16) {
int wtheta=5;
int w=32;
for (int m = 0; m < blocks16x16.length; m++) {
BufferedImage imageblock = blocks16x16[m];
int width = imageblock.getWidth();
int height = imageblock.getHeight();
WritableRaster raster = imageblock.getRaster();
int[][] pixel = new int[width][height];
int[] array = new int[1];
int [][] Vx = new int[width][height];
int [][] Vy = new int[width][height];
int [][] theta = new int[width][height];
int [][]phix=new int[width][height];
int [][]phiy=new int[width][height];
int [][]phidashx=new int[width][height];
int [][]phidashy=new int[width][height];
int [][] O = new int[width][height];
int [][] filter = new int[width][height];
int [][] xsignature = new int[width][height];
for(int x=0;x<width;x++)
{
for(int y=0;y<height;y++)
{
raster.getPixel(x, y,array);
pixel[x][y]=array[0];
}
}
int M = getMean(pixel,imageblock);
int Sigma = getStanderDeaviation(pixel,M);
for(int i=0;i<pixel.length;i++)
{
for(int j=0;j<pixel[i].length;j++)
{
int x=0;
for(int u=(-wtheta/2);u<(wtheta/2);u++)
{
for(int v=(-wtheta/2);v<(wtheta/2);v++)
{
for(int p=(i-(u*w)-(w/2));p<(i-(v*w)+(w/2));p++)
{
for(int q=(j-(v*w)-(w/2));q<(j-(v*w)+(w/2));q++)
{
Vx[p][q] = 2*(pixel[p][q-1] - pixel[p][q+1])*(pixel[p+1][q] - pixel[p-1][q]);
Vy[p][q] =((int) Math.pow((pixel[p][q-1] - pixel[p][q+1]), 2))*(int) Math.pow((pixel[p+1][q] - pixel[p-1][q]),2);
theta[p][q] = (int) ((1/2)*Math.atan(Vy[p][q]/Vx[p][q]));
phix[p][q] = (int) Math.cos(2*theta[p][q]);
phiy[p][q] = (int) Math.sin(2*theta[p][q]);
filter[u][v] = getGaussianFilter(u,v,Sigma);
phidashx[i][j] += filter[u][v]*phix[p][q];
phidashy[i][j] += filter[u][v]*phiy[p][q];
}
}
}
}
O[i][j] = (int) ((1/2)*Math.atan((phidashy[i][j])/phidashx[i][j]));
for(int k=0;k<w;k++)
{
for(int d=0;d<w-1;d++)
{
int u=(int) ((i+(d-(w/2))*Math.cos(O[i][j]))+(k-1/2)*Math.sin(O[i][j]));
int v= (int) ((i+(d-(w/2))*Math.sin(O[i][j]))+(1/2-k)*Math.sin(O[i][j]));
raster=imageblock.getRaster();
int[] iArray=new int[1];
iArray[0]= O[i][j];
raster.getPixel(u, v, iArray);
x+=iArray[0];
}
}
raster=imageblock.getRaster();
int[] iArray=new int[1];
iArray[0]= x;
xsignature[i][j] = x;
raster.setPixel(i, j, iArray);
}
}
imageblock.setData(raster);
blocks16x16[m] = imageblock;
}
return blocks16x16;
}