image-processing - 通过使用 matlab 应用 Gabor 方程创建 Gabor 滤波器

标签 image-processing computer-vision matlab

我尝试创建一个 Gabor 过滤器。我们都知道这种过滤器比任何其他过滤器都复杂,因为它具有更复杂的特征,例如具有不同的尺度和方向。 Gabor滤波器的方程为:

enter image description here

要创建具有特定比例和方向的 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=sigmasigma_y=sigma/gamma ... 我们有 gb=exp(-.5* (x_theta.....))。我不明白等式中的 5 是什么..

上面写的matlab代码是否正确响应了Gabor滤波器的方程??我需要您的意见,如果代码不正确,请尽可能优化它。

我们将不胜感激。

最佳答案

在您的代码中替换以下行:

gb= exp(-.5*(x_theta.^2/sigma_x^2+y_theta.^2/sigma_y^2)).*cos(2*pi/lambda*x_theta+psi);

我在上面的 matlab 代码中用 sin 替换了 cos。

关于image-processing - 通过使用 matlab 应用 Gabor 方程创建 Gabor 滤波器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20147891/

相关文章:

android - 如何合并图像并相互叠加

opencv - 如何在 OpenCV 中合并重叠矩形? (Python)

opencv - opencv模板匹配->获取确切位置?

java - 在 Matlab 中使用 java BufferedRead 和 TCP/IP 以太网连接 - 访问最新数据

Matlab:创建 3D 立方体 RGB 并显示它

python - 如何使用机器学习(Tensorflow)使用新数据集构建图像处理模型?

python - 在 python 中显示像素数组中的图像时出错

matlab - 如何绘制由 TrainCascadeObjectDetector 生成的检测器的 ROC 曲线?

opencv - 旋转矩阵的微小变化完全破坏了立体声重建

matlab - 创建向量