资源简介
Gabor变换 MATLAB程序 根据理论自己编写
代码片段和文件信息
function [gb_regb_imgb_ampgb_size]=CreateGaborFilter(bwgammapsilambdatheta)
% bw = bandwidth (1)
% gamma = aspect ratio (0.5)
% psi = phase shift (0)
% lambda= wave length (>=2)
% theta = angle in rad [0 pi)
sigma = lambda/pi*sqrt(log(2)/2)*(2^bw+1)/(2^bw-1);
sigma_x = sigma;
sigma_y = sigma/gamma;
gb_size=fix(8*max(sigma_ysigma_x));
if mod(gb_size2)==0 gb_size=gb_size+1;end
% alternatively use a fixed size
% sz = 60;
[x y]=meshgrid(-fix(gb_size/2):fix(gb_size/2)-fix(gb_size/2):1:fix(gb_size/2));
% x (right +)
% y (up +)
% Rotation
x_theta=x*cos(theta)+y*sin(theta);
y_theta=-x*sin(theta)+y*cos(theta);
gb_re=exp(-0.5*(x_theta.^2/sigma_x^2+y_theta.^2/sigma_y^2)).*cos(2*pi/lambda*x_theta+psi);
gb_im=exp(-0.5*(x_theta.^2/sigma_x^2+y_theta.^2/sigma_y^2)).*sin(2*pi/lambda*x_theta+psi);
gb_amp=exp(-0.5*(x_theta.^2/sigma_x^2+y_theta.^2/sigma_y^2));
%figure;
%imshow(gb/2+0.5);
%imshow(gb); %直接显示的gabor filter非常难看
%title(‘gabor filter‘);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1012 2014-07-13 09:42 gabor\CreateGaborFilter.m
文件 877 2014-07-13 10:18 gabor\gabortest.m
文件 661 2014-02-15 19:39 gabor\OTSU.m
目录 0 2014-07-13 10:19 gabor
----------- --------- ---------- ----- ----
2550 4
评论
共有 条评论