/* minutiae.c */ /* extraction of minutiae candidates in skeletonized fingerprint image */ #include #include #include "mypgm.h" #define BLACK 0 #define WHITE 255 #define GRAY 200 /* prototype declaration */ void minutiae(); int crossnumber(int, int); int main( ) { load_image_data( ); /* loading image1 */ minutiae( ); /* extracting minutiae candidates */ save_image_data( ); /* saving image2 */ return 0; } void minutiae() { int x, y; int total, np1, np2; /* number of black and minutiae points */ int cross; /* initialization of output image */ x_size2 = x_size1; y_size2 = y_size1; for (y = 0; y < y_size2; y++) { for (x = 0; x < x_size2; x++) { if (image1[y][x] == BLACK) { image2[y][x] = GRAY; } else { image2[y][x] = WHITE; } } } /* finding minutiae in 3 x 3 window */ printf("Minutiae extraction is applied to skeletonized fingerprint.\n"); total = 0; np1 = 0; /* number of ending points */ np2 = 0; /* number of bifurcations */ for (y = 1; y < y_size1 -1; y++) { for (x = 1; x < x_size1 - 1; x++) { if (image1[y][x] == BLACK) { total++; cross = crossnumber(y, x); if (cross == 1) { np1++; image2[y][x] = BLACK; } else if (cross >= 3) { np2++; image2[y][x] = BLACK; } } } } printf("total number of BLACK points = %d\n", total); printf("number of ending points = %d\n", np1); printf("number of bifurcations = %d\n\n", np2); } int crossnumber(int y, int x) { int i, data[8]; int cross; data[0] = image1[y][x+1] == BLACK ? 1 : 0; data[1] = image1[y-1][x+1] == BLACK ? 1 : 0; data[2] = image1[y-1][x] == BLACK ? 1 : 0; data[3] = image1[y-1][x-1] == BLACK ? 1 : 0; data[4] = image1[y][x-1] == BLACK ? 1 : 0; data[5] = image1[y+1][x-1] == BLACK ? 1 : 0; data[6] = image1[y+1][x] == BLACK ? 1 : 0; data[7] = image1[y+1][x+1] == BLACK ? 1 : 0; cross = 0; for (i = 0; i < 8; i++) { cross += abs(data[(i+1)%8] - data[i]); } cross /= 2; return cross; }