2015-05-09 47 views
5

我在圖像上應用Gabor filter以下圖像theta - {0,45,90,135}。但生成的圖像在相同的方向角上完全相同!Gabor濾波器的不同'theta'返回無方向圖像

我預期用THETA施加Gabor濾波器的結果= 90將在取向是不同的一個比與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度:用THETA = 0,45,90,135施加伽柏後 enter image description here

圖像,無需平滑: enter image description here

+0

您能向我們展示您編寫的將Gabor濾鏡應用於圖像的代碼嗎? – rayryeng

+0

@rayryeng對於最近的回覆抱歉,請找到代碼並輸出以上更新 – user2121

+0

@ user2121請將'lambda'更改爲10.讓我知道您是否有任何改變。 –

回答

0

也許問題就在這裏:

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

而且我不知道拉姆達和PSI值。也許你應該嘗試看到不同值的結果圖像。

最後,Gabor結果就是你所說的image_0度,image_45度。即使它們之間沒有明顯的變化,我也會改變參數