程序如下,现在不知道怎样做特征(定位)提取和匹配 请高手指点
f=imread('1_1.bmp');%读入图像
imshow(f)
title('指纹原图')
I=ordfilt2(f,5,ones(3,3));%对图像进行3*3的中值滤波
figure,imshow(I)
title('中值滤波')
h=fspecial('unsharp',0.5);%进行锐化
H=filter2(h,I);
figure,imshow(H)
title('锐化')
t=graythresh(I);%二值化后的图像(otsu阈值法)
u=im2bw(H,t);
figure,imshow(u)
title('二值化')
[m,n]=size(u) %去除空洞和毛刺
for x=2:m-1
for y=2:n-1
if u(x,y)==0
if u(x,y-1)+u(x-1,y)+u(x,y+1)+u(x+1,y)>=3
u(x,y)=1;
end
else u(x,y)=u(x,y);
end
end
end
figure,imshow(u)
title('去除毛刺')
for a=2:m-1
for b=2:n-1
if u(a,b)==1
if abs(u(a,b+1)-u(a-1,b+1))+abs(u(a-1,b+1)-u(a-1,b))+abs(u(a-1,b)-u(a-1,b-1))+abs(u(a-1,b-1)-u(a,b-1))+abs(u(a,b-1)-u(a+1,b-1))+abs(u(a+1,b-1)-u(a+1,b))+abs(u(a+1,b)-u(a+1,b+1))+abs(u(a+1,b+1)-u(a,b+1))~=1%寻找端点
if (u(a,b+1)+u(a-1,b+1)+u(a-1,b))*(u(a,b-1)+u(a+1,b-1)+u(a+1,b))+(u(a-1,b)+u(a-1,b-1)+u(a,b-1))*(u(a+1,b)+u(a+1,b+1)+u(a,b+1))==0 %去除毛刺和空洞
u(a,b)=0;
end
end
end
end
end
figure,imshow(u)
title('去除空洞')
v=~u;
w=bwmorph(v,'thin',Inf);%对图像进行细化
figure,imshow(w)
title('细化图')