?? preprocessing.m
字號:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% preprocessing for the fingerprint identification
% written by zhang_rui at Chinese Academy of Science
% E-mail:zhangrui05@mails.gucas.ac.cn
% 2006/6/3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [Y]=preprocessing(A);
[M,N]=size(A);
if (mean(A)<=10)
valve=graythresh(A);
else
valve=255*graythresh(A);
end
%--------------------------------------------------------------------------
%Perform two-dimensional median filtering
A=medfilt2(A,[5,5]);
%figure;
%imshow(A,[]);
%--------------------------------------------------------------------------
%Perform Wiener filter
A=wiener2(A);
%figure;
%imshow(A,[]);
%--------------------------------------------------------------------------
%gray to logical
%for i=1:M
% for j=1:N
% if(A(i,j)>valve)
% A(i,j)=1;
% else
% A(i,j)=0;
% end
% end
%end
A=~im2bw(A,0.6*graythresh(A));
%figure;
%imshow(A,[]);
%--------------------------------------------------------------------------
%skeletonization the picture
%A=not(A);
A=bwmorph(A,'skel',Inf);
%figure;
%imshow(A,[]);
A=bwmorph(A,'spur',2);
%figure;
%imshow(A,[]);
Y=A;
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -