您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 广告经营 > matlab指纹方向场方向图程序
functionFangxiangtu=zhiwen_fangxiangtu(Zhiwentuxiang)%函数功能计算指纹方向图%函数参数指纹图像Zhiwentuxiang%函数返回值指纹方向图FangxiangtuSizeZhiwentuxiang=size(Zhiwentuxiang);Zhiwentuxiang=double(Zhiwentuxiang);W=4;%窗口大小(2W+1)*(2W+1)W=4;%Sobel算子x_fangxiang=[-101;-202;-101];y_fangxiang=[121;000;-1-2-1];SizeZhiwentuxiang=size(Zhiwentuxiang);Gx=zeros(SizeZhiwentuxiang);Gy=zeros(SizeZhiwentuxiang);Fangxiangtu=zeros(SizeZhiwentuxiang);fori=2:SizeZhiwentuxiang(1,1)-1forj=2:SizeZhiwentuxiang(1,2)-1Sum_x=0;%j方向Sum_y=0;%i方向fork=-1:1forr=-1:1Sum_x=Sum_x+x_fangxiang(k+2,r+2)*Zhiwentuxiang(i+k,j+r);Sum_y=Sum_y+y_fangxiang(k+2,r+2)*Zhiwentuxiang(i+k,j+r);endendGx(i,j)=Sum_x;Gy(i,j)=Sum_y;endendfori=W+1:SizeZhiwentuxiang(1,1)-Wforj=W+1:SizeZhiwentuxiang(1,2)-WVx=0;Vy=0;forio=-W:Wforjo=-W:WVy=Vy+2*Gx(i+io,j+jo)*Gy(i+io,j+jo);Vx=Vx+Gx(i+io,j+jo).^2-Gy(i+io,j+jo).^2;endendifVx~=0th=atan(Vy/Vx)/2;Fangxiangtu(i,j)=th;elseFangxiangtu(i,j)=pi/2;endendend
本文标题:matlab指纹方向场方向图程序
链接地址:https://www.777doc.com/doc-7319764 .html