请选择 进入手机版 | 继续访问电脑版

Hello Mat

 找回密码
 立即注册
查看: 6243|回复: 0

Gabor滤波

[复制链接]

1278

主题

1504

帖子

90

金钱

管理员

Rank: 9Rank: 9Rank: 9

积分
22549
发表于 2017-9-21 21:57:12 | 显示全部楼层 |阅读模式
Gabor滤波:
Sx = 0.5;  % x方向的差异系数
Sy = 0.5;  % y方向的差异系数
U = 1.0;   % x方向的中心频率
V = 1.0;   % y方向的中心频率
[G,gabout] = gabor_filter(im,Sx,Sy,U,V);

  1. function [G,gabout] = gabor_filter(I,Sx,Sy,U,V)
  2. % 函数输入:
  3. %          I : 输入的二维图像
  4. %          Sx & Sy : 方差 along x and y-axes respectively
  5. %          U & V : 中心频率  along x and y-axes respectively
  6. % 函数输出:
  7. %          G : G(x,y)
  8. %          gabout : Gabor滤波图像
  9. % G(x,y)表达式如下:
  10. %               1                -1     x  ^    y  ^
  11. %%% G(x,y) = ---------- * exp ([----{(----) 2+(----) 2}+2*pi*i*(Ux+Vy)])
  12. %            2*pi*sx*sy           2    sx       sy

  13. if isa(I,'double')~=1
  14.     I = double(I);
  15. end

  16. for x = -fix(Sx):fix(Sx)
  17.     for y = -fix(Sy):fix(Sy)
  18.         G(fix(Sx)+x+1,fix(Sy)+y+1) = (1/(2*pi*Sx*Sy))*exp(-.5*((x/Sx)^2+(y/Sy)^2)+2*pi*i*(U*x+V*y));
  19.     end
  20. end

  21. Imgabout = conv2(I,double(imag(G)),'same');  % 卷积
  22. Regabout = conv2(I,double(real(G)),'same');  % 卷积

  23. gabout = uint8(sqrt(Imgabout.*Imgabout + Regabout.*Regabout)); % 输出滤波图像
复制代码

参考:【1】http://halcom.cn/forum.php?mod=viewthread&tid=737

算法QQ  3283892722
群智能算法链接http://halcom.cn/forum.php?mod=forumdisplay&fid=73
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Python|Opencv|MATLAB|Halcom.cn ( 蜀ICP备16027072号 )

GMT+8, 2024-3-28 22:24 , Processed in 0.218135 second(s), 25 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表