-
Notifications
You must be signed in to change notification settings - Fork 0
/
Minutuae_Extraction.m
executable file
·126 lines (103 loc) · 3.83 KB
/
Minutuae_Extraction.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
%Program for Fingerprint Minutiae Extraction
%Program Description
%This program extracts the ridges and bifurcation from a fingerprint image
%Read Input Image
binary_image=im2bw(imread('input_1.tif'));
%Small region is taken to show output clear
binary_image = binary_image(120:400,20:250);
figure;imshow(binary_image);title('Input image');
%Thinning
thin_image=~bwmorph(binary_image,'thin',Inf);
figure;imshow(thin_image);title('Thinned Image');
%Minutiae extraction
s=size(thin_image);
N=3;%window size
n=(N-1)/2;
r=s(1)+2*n;
c=s(2)+2*n;
temp=zeros(r,c);bifurcation=zeros(r,c);ridge=zeros(r,c);
temp((n+1):(end-n),(n+1):(end-n))=thin_image(:,:);
outImg=zeros(r,c,3);%For Display
outImg(:,:,1) = temp .* 255;
outImg(:,:,2) = temp .* 255;
outImg(:,:,3) = temp .* 255;
for x=(n+1+10):(s(1)+n-10)
for y=(n+1+10):(s(2)+n-10)
e=1;
for k=x-n:x+n
f=1;
for l=y-n:y+n
mat(e,f)=temp(k,l);
f=f+1;
end
e=e+1;
end;
if(mat(2,2)==0)
ridge(x,y)=sum(sum(~mat));
bifurcation(x,y)=sum(sum(~mat));
end
end;
end;
figure;imshow(outImg);title('sample Image');
% RIDGE END FINDING
[ridge_x ridge_y]=find(ridge==2);
len=length(ridge_x);
%For Display
for i=1:len
outImg((ridge_x(i)-3):(ridge_x(i)+3),(ridge_y(i)-3),2:3)=0;
outImg((ridge_x(i)-3):(ridge_x(i)+3),(ridge_y(i)+3),2:3)=0;
outImg((ridge_x(i)-3),(ridge_y(i)-3):(ridge_y(i)+3),2:3)=0;
outImg((ridge_x(i)+3),(ridge_y(i)-3):(ridge_y(i)+3),2:3)=0;
outImg((ridge_x(i)-3):(ridge_x(i)+3),(ridge_y(i)-3),1)=255;
outImg((ridge_x(i)-3):(ridge_x(i)+3),(ridge_y(i)+3),1)=255;
outImg((ridge_x(i)-3),(ridge_y(i)-3):(ridge_y(i)+3),1)=255;
outImg((ridge_x(i)+3),(ridge_y(i)-3):(ridge_y(i)+3),1)=255;
end
figure;imshow(outImg);title('sample Image');
%BIFURCATION FINDING
[bifurcation_x bifurcation_y]=find(bifurcation==4);
len=length(bifurcation_x);
%For Display
for i=1:len
outImg((bifurcation_x(i)-3):(bifurcation_x(i)+3),(bifurcation_y(i)-3),1:2)=0;
outImg((bifurcation_x(i)-3):(bifurcation_x(i)+3),(bifurcation_y(i)+3),1:2)=0;
outImg((bifurcation_x(i)-3),(bifurcation_y(i)-3):(bifurcation_y(i)+3),1:2)=0;
outImg((bifurcation_x(i)+3),(bifurcation_y(i)-3):(bifurcation_y(i)+3),1:2)=0;
outImg((bifurcation_x(i)-3):(bifurcation_x(i)+3),(bifurcation_y(i)-3),3)=255;
outImg((bifurcation_x(i)-3):(bifurcation_x(i)+3),(bifurcation_y(i)+3),3)=255;
outImg((bifurcation_x(i)-3),(bifurcation_y(i)-3):(bifurcation_y(i)+3),3)=255;
outImg((bifurcation_x(i)+3),(bifurcation_y(i)-3):(bifurcation_y(i)+3),3)=255;
end
disp(size(ridge_x))
disp(size(ridge_y))
disp(size(bifurcation_x))
disp(size(bifurcation_y))
#concatenating the x,y minutiae coordinates
minutiae_x = vertcat(ridge_x,bifurcation_x)
minutiae_y = vertcat(ridge_y,bifurcation_y)
ridges = horzcat(ridge_x,ridge_y);
bifurcation = horzcat(bifurcation_x,bifurcation_y);
minutiae = horzcat(minutiae_x,minutiae_y);
figure;imshow(outImg);title('Minutiae');
#plotting the minutiae points as a graph
figure;plot(minutiae_x,minutiae_y,'*');title('Minutiae Points Graph')
#calculating the distance between the selected reference minutiae point with all other minutiae points
distance =[];
disp('length')
disp(length(minutiae))
for i=2:length(minutiae)
distance(i) = sqrt(((minutiae_x(i)-minutiae_x(1))*(minutiae_x(i)-minutiae_x(1)))+((minutiae_y(1)-minutiae_y(i))*(minutiae_y(1)-minutiae_y(i))));
end
disp(distance);
x = 2:length(minutiae)
disp(x)
y = distance(x)
figure
plot(x,y,'--gs',...
'LineWidth',2,...
'MarkerSize',10,...
'MarkerEdgeColor','b',...
'MarkerFaceColor',[0.5,0.5,0.5])
title('Distance Graph')
xlabel('x')
ylabel('distance from reference minutiae')