当前位置:   article > 正文

指纹图像方向图matlab,matlab指纹方向场方向图程序

指纹方向场代码

function Fangxiangtu = zhiwen_fangxiangtu( Zhiwentuxiang )

%函数功能计算指纹方向图

%函数参数指纹图像Zhiwentuxiang

%函数返回值指纹方向图Fangxiangtu

SizeZhiwentuxiang = size( Zhiwentuxiang ) ;

Zhiwentuxiang = double( Zhiwentuxiang ) ;

W = 4; % 窗口大小(2W+1)*(2W+1)

W = 4;

%Sobel算子

x_fangxiang = [-1 0 1;

-2 0 2;

-1 0 1];

y_fangxiang = [1 2 1;

0 0 0;

-1 -2 -1];

SizeZhiwentuxiang = size( Zhiwentuxiang );

Gx = zeros( SizeZhiwentuxiang );

Gy = zeros( SizeZhiwentuxiang );

Fangxiangtu = zeros( SizeZhiwentuxiang );

for i = 2 : SizeZhiwentuxiang( 1 , 1 ) - 1

for j = 2 : SizeZhiwentuxiang( 1, 2 ) - 1

Sum_x = 0;%j方向

Sum_y = 0;%i方向

for k = -1 : 1

for r = -1 : 1

Sum_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 );

end

end

Gx( i , j ) = Sum_x ;

Gy( i , j ) = Sum_y ;

end

end

for i = W+1 : SizeZhiwentuxiang( 1 , 1 ) - W

for j = W+1 : SizeZhiwentuxiang( 1, 2 ) - W

Vx = 0;

Vy = 0 ;

for io = -W : W

for jo = -W : W

Vy = 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;

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/327114
推荐阅读
相关标签
  

闽ICP备14008679号