Gabor滤波器的不同'theta'返回没有方向的图像 [英] Different 'theta' for Gabor Filter Returns Images with no Orientation
问题描述
我在带有以下 theta 的图片上应用 Gabor过滤器 - {0,45,90,135}。但是得到的图像在相同的方向角下完全相同!
I applied Gabor filter on images with the following theta- {0,45,90,135}. but the resultant images were exactly the same with the same orientation angle!
我预计使用 theta = 90 的Gabor过滤器的结果与 theat = 45的结果不同,但在使用不同 theta 的Gabor滤镜后,我得到的图像没有方向差异!
I expected that the results of applying Gabor filter with theta = 90 will be different in orientation than the one with theat = 45, but after using Gabor filter with different theta, I get images with no difference in orientation!
我是否使用Gabor滤镜错误?因为我希望每个图像根据Gabor滤波器中指定的方向角度具有不同的方向。
Am I using Gabor filter wrong? Because I expect every image to be of different orientation according to the orientation angel specified in the Gabor filter.
我为Gabor滤波器设置的参数如下:
The parameter I set for Gabor filter were as follows:
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度:
image_45度:
image_90度:
image_135度:
使用theta = 0,45,90,135应用Gabor后的图像,没有平滑:
推荐答案
问题可能就在这里:
Mat gaborCoeff = Imgproc.getGaborKernel(new Size(3,3), 2, theta[i], 4.1, 54.1, 0, CvType.CV_32F);
我认为它应该是这样的:
I think it should be something like:
Mat gaborCoeff = Imgproc.getGaborKernel(new Size(3,3), sigma, theta[i], lambda, psi, 0, CvType.CV_32F);
我不确定lambda和psi的值。也许您应该尝试使用不同的值查看生成的图像。
And I'm not sure about the values of lambda and psi. Maybe you should try to see the resulting images with different values.
最后,Gabor结果就是你所谓的image_0度,image_45度。即使它们之间没有重大变化,我也会改变参数
Finally, Gabor result is what you called image_0 degree, image_45 degree. Even though there is no significant change between them, I would change the parameters
这篇关于Gabor滤波器的不同'theta'返回没有方向的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!