sivasubramani
Newbie level 1
- Joined
- Apr 18, 2013
- Messages
- 1
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,286
Dear all,
i am new to image processing, i am trying generate a fingerprint image orientation using gradient based method using the following c code. while i try to overlay the orientation on the fingerprint image it is not proper. can any one suggest me if any changes is to be made in this code and also suggest me a best fingerprint orientation algorithm.
i am new to image processing, i am trying generate a fingerprint image orientation using gradient based method using the following c code. while i try to overlay the orientation on the fingerprint image it is not proper. can any one suggest me if any changes is to be made in this code and also suggest me a best fingerprint orientation algorithm.
Code:// extracts the orientations orientations = malloc(sizeof(byte*)*fgRows); for (y = 0; y < fgRows; y++) { orientations[y] = malloc(fgColumns); ZeroMemory(orientations[y],fgColumns); for (x = 0; x < fgColumns; x++) { if (foreground[y][x]) { int px = border + x * step; int py = border + y * step; int i,j,k,l,m,n; double dx[step][step],dy[step][step]; double gx,gy; double nx,ny,ne,coh; int sx[3][3] = {{-1,0,1},{-2,0,2},{-1,0,1}}; int sy[3][3] = {{-1,-2,-1},{0,0,0},{1,2,1}}; int sumX,sumY; // TODO: estimate local orientation at pixel (px,py) // and store it into orientations[y][x] if(px<imageWidth && py<imageHeight) { for(i=py,k=0; i<py+step; i++,k++) { for(j=px,l=0; j<px+step; j++,l++) { dx[k][l] = image[i*imageWidth+(j+1)]-image[i*imageWidth+(j-1)]; dy[k][l] = image[(i+1)*imageWidth+j]-image[(i-1)*imageWidth+j]; } } for(i=0; i<step; i++) { for(j=0; j<step; j++) { gx += 2*dx[i][j]*dy[i][j]; gy += dx[i][j]*dx[i][j]-dy[i][j]*dy[i][j]; } } orientations[y][x] = (int)(0.5*atan2(gx,gy)*(3.14159265358f*0.5)); gx = 0.0; gy = 0.0; } } }