fp=imread('image1.tif'); %读入指纹图象
imshow(fp);title('原始指纹图象') %显示指纹图象
%以下是对原始指纹图象进行归一化,归一化后的灰度均值M0设为100,方差Var0为100
M0=100;
Var0=100;
[len,wid]=size(fp);
fpn=zeros(len,wid); %为归一化后的图象设置存储空间
M=mean2(fp); %求原始指纹图象灰度均值
Var=std2(fp)^2; %求原始指纹图象灰度方差
%归一化
fp=double(fp); %将uint8型转换成double,便于sqrt的计算
for i=1:len
for j=1:wid
if fp(i,j)>M
fpn(i,j)=M0+sqrt( Var0*(fp(i,j)-M)^2/Var );
else
fpn(i,j)=M0-sqrt( Var0*(fp(i,j)-M)^2/Var );
end
end
end
fpn=uint8(fpn);
figure,imshow(fpn);title('归一化后的指纹图象'); %显示归一化后的指纹图象
case 1
angle_xy(4,[2:7])=0; %方向1,即方向为0度时,令第8行第2-15列的元素为0(黑色)
case 2
idx=sub2ind(size(angle_xy),[ 3 4 4 5 5 6 ],[2:7]);
angle_xy(idx)=0;
case 3
idx=sub2ind(size(angle_xy),[2:7],[2:7]);
angle_xy(idx)=0;
case 4
idx=sub2ind(size(angle_xy),[2:7],[ 3 4 4 5 5 6 ]);
angle_xy(idx)=0;
case 5
angle_xy([2:7],4)=0;
case 6
idx=sub2ind(size(angle_xy),[7:-1:2],[ 3 4 4 5 5 6 ]);
angle_xy(idx)=0;
case 7
idx=sub2ind(size(angle_xy),[7:-1:2],[7:-1:2]);
angle_xy(idx)=0;
case 8
idx=sub2ind(size(angle_xy),[ 6 5 5 4 4 3 ],[2:7]);
angle_xy(idx)=0;
end
block_dmap([1+(i-1)*8:8+(i-1)*8],[1+(j-1)*8:8+(j-1)*8])=angle_xy;