gpt4 book ai didi

java - Gabor 过滤器的不同 'theta' 返回没有方向的图像

转载 作者:搜寻专家 更新时间:2023-11-01 00:55:57 24 4
gpt4 key购买 nike

我申请了 Gabor filter在具有以下 theta - {0,45,90,135} 的图像上。但是生成的图像在相同的方向角下完全相同!

我预计应用 theta = 90 的 Gabor 滤波器的结果在方向上与 theat = 45 的结果不同,但是在使用不同的 Gabor 滤波器之后theta,我得到的图像在方向上没有差异!

我是不是用错了 Gabor 过滤器?因为我希望根据 Gabor 滤波器中指定的方向角,每张图像都具有不同的方向。

我为Gabor滤波器设置的参数如下:

kernel size = Size(5,5);
theta = {0,45,90,135}
sigma = ,2
type = CVType.CV_32F
lambda = 100
gamma = ,5
psi = 5

代码:

public static void main(String[] args) {

MatFactory matFactory = new MatFactory();
FilePathUtils.addInputPath(path_Obj);
Mat bgrMat = matFactory.newMat(FilePathUtils.getInputFileFullPathList().get(0));
Mat gsImg = SysUtils.rgbToGrayScaleMat(bgrMat);
double[] theta = new double[4];
theta[0] = 0;
theta[1] = 45;
theta[2] = 90;
theta[3] = 135;

for (int i = 0; i < 4; i++) {
Mat gaborCoeff = Imgproc.getGaborKernel(new Size(3,3), 2, theta[i], 4.1, 54.1, 0, CvType.CV_32F);
Mat dest = new Mat();
Imgproc.filter2D(gsImg, dest, CvType.CV_32F, gaborCoeff);
ImageUtils.showMat(dest, "theta = " + theta[i]);
}

}

image_0 度数: enter image description here

image_45度数: enter image description here

image_90度: enter image description here

image_135度数: enter image description here

应用 Gabor with theta=0,45,90,135 后的图像,没有平滑: enter image description here

最佳答案

可能问题出在这里:

Mat gaborCoeff = Imgproc.getGaborKernel(new Size(3,3), 2, theta[i], 4.1, 54.1, 0, CvType.CV_32F);

我觉得应该是这样的:

Mat gaborCoeff = Imgproc.getGaborKernel(new Size(3,3), sigma, theta[i], lambda, psi, 0, CvType.CV_32F);

而且我不确定 lambda 和 psi 的值。也许您应该尝试查看具有不同值的结果图像。

最后,Gabor 结果就是你所说的 image_0 度,image_45 度。即使它们之间没有显着变化,我也会更改参数

关于java - Gabor 过滤器的不同 'theta' 返回没有方向的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30141879/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com