【发布时间】:2013-12-07 12:17:32
【问题描述】:
我尝试创建一个 Gabor 过滤器。我们都知道这种过滤器比任何其他过滤器都更复杂,因为它具有更复杂的特征,例如具有不同的尺度和方向。 Gabor滤波器方程为:
要创建这样一个具有特定比例和方向的 Gabor 滤波器,wikipedia 为我们提供了一个简单的 matlab 代码:
sigma_x = sigma;
sigma_y = sigma/gamma;
nstds = 3;
xmax = max(abs(nstds*sigma_x*cos(theta)),abs(nstds*sigma_y*sin(theta)));
xmax = ceil(max(1,xmax));
ymax = max(abs(nstds*sigma_x*sin(theta)),abs(nstds*sigma_y*cos(theta)));
ymax = ceil(max(1,ymax));
xmin = -xmax; ymin = -ymax;
[x,y] = meshgrid(xmin:xmax,ymin:ymax);
x_theta=x*cos(theta)+y*sin(theta);
y_theta=-x*sin(theta)+y*cos(theta);
gb= exp(-.5*(x_theta.^2/sigma_x^2+y_theta.^2/sigma_y^2)).*cos(2*pi/lambda*x_theta+psi);
我想知道这段代码是否正确。我注意到上面的代码并没有完全响应 Gabor 滤波器的方程。例如:在代码中,我们有:sigma_x=sigma 和 sigma_y=sigma/gamma ... 我们有 gb=exp(-.5*(x_theta.....))。我不明白等式中的5 是什么..
上面写的matlab代码是否正确响应了Gabor滤波器的方程??请我需要您的意见,如果代码不正确,请尽可能优化代码。
任何帮助将不胜感激。
【问题讨论】:
标签: image-processing computer-vision matlab