Different 'theta' for Gabor Filter Returns Images with no Orientation

旧街凉风 提交于 2019-12-10 14:28:34

问题


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!

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!

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.

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

code:

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 degree:

image_45 degree:

image_90 degree:

image_135 degree:

image after applying Gabor with theta=0,45,90,135, without smoothing :


回答1:


Maybe the problem is here:

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);

And I'm not sure about the values of lambda and psi. Maybe you should try to see the resulting images with different values.

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



来源:https://stackoverflow.com/questions/30141879/different-theta-for-gabor-filter-returns-images-with-no-orientation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!