📄 pic2vec.m
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Main function for the fingerprint identification
% gets the character vector from the fingerprint picture
% written by zhang_rui at Chinese Academy of Science
% E-mail:zhangrui05@mails.gucas.ac.cn
% 2006/6/3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%--------------------------------------------------------------------------
% a short description:
% input a gray fingerprint picture return the character vector of it.
% The main function calls :img=preprocessing(A);[ii,jj]=centralizing(A);
% Sam=samfun(r,R,n,N1);The following list gives a brief description:
%--------------------------------------------------------------------------
%M-file list:
%
% preprocessing.m:(be called by main function pic2vec)
% preprocess the picture including:Wiener filter;
% meddle value filter, change a gray picture to a
% binary one and then get the skeleton.
% centralizing.m: (be called by main function pic2vec)
% input the source picture output the core point of
% the fingerprint.Gabor filter is used in this function,
% and it call gabor2d_sub.m to generate a Gabor filter.
% it also call varpic.m to calculate a variance picture.
% samfun.m: (be called by main function pic2vec)
% generate the sample pattern automatically, which is
% used to sample the fingerprint.
% gabor2d_sub: (be called by centralizing.m)
% get gabor filter.
% varpic.m: (be called by centralizing.m)
% calculate variance picture
%--------------------------------------------------------------------------
% Globl parameter:
%
% the following parameter is used to define the sample pattern
% all these parameter is extremely correlate to the application
% and can be decided by experiment
% r=radius of smallest circle(default 10)
% R=radius of the biggest circls(default 160)
% n=number of the circle(default 7)
% N1=first circle's sample N1 times(default 4)
%--------------------------------------------------------------------------
function cha=pic2vec(A)
r=10;%r=10;
R=110;%R=160;
n=5;%n=7;
N1=4;%N1=4;
%--------------------------------------------------------------------------
%call preprocessing(),findcentral(),and samfun
img=preprocessing(A);
[ii,jj]=centralizing(A);
Sam=samfun(r,R,n,N1);
%ii=250;
%jj=200;
%[Outputprint,XofCenter,YofCenter]=centralizing(img);
%--------------------------------------------------------------------------
%sampling the fingerprint
[Mp,Np]=size(img);
[Ms,Ns]=size(Sam);
img=and(img((ii-fix(Ms/2)):(ii+fix(Ms/2)),(jj-fix(Ms/2)):(jj+fix(Ms/2))),Sam);
figure;
imshow(img,[]);
%--------------------------------------------------------------------------
%generate the character vector
veclen=N1*(1+n)*n/2;
cha=zeros(1,veclen);
width=(R-r)/n;
for i=1:n
if(i==1)
r=r;
else
r=r+width;
end
for j=1:N1*i
sita=2*pi*(j-1)/(N1*i);
temp=0;
for k=1:width
if((img(R-fix((r+k-1)*sin(sita)),R+fix((r+k-1)*cos(sita))))==1&temp==0)
temp=1;
cha((i-1)*i*N1/2+j)=cha((i-1)*i*N1/2+j)+1;
else
if((img(R-fix((r+k-1)*sin(sita)),R+fix((r+k-1)*cos(sita))))==0)
temp=0;
end
end
end
end
end
end
figure;
stem(cha);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -