How to segment a textured image using Gabor Filters?

I am following a matlab implementation of texture segmentation using Gabor filters. My test image (img) is from Brodatz and as follows:

n1mMl How to segment a textured image using Gabor Filters?

Below is what I have done so far.

{nrows, ncols} = ImageDimensions[img];
wavelengthmin = 4/Sqrt[2];
wavelengthmax = Sqrt[nrows^2 + ncols^2];
n = Floor[Log2[wavelengthmax/wavelengthmin]];
wavelength = Table[{2, 2} 2^i, {i, 0, n - 2}];
deltaTheta = Pi/4;
orientation = Table[i, {i, 0, Pi - deltaTheta, deltaTheta}];
gabormag = 
  Flatten[Table[
    ImageAdjust[
     GaborFilter[img, 1, wavelength[[i]], orientation[[j]]]], {i, 1, 
     Length@wavelength}, {j, 1, Length@orientation}]];
gaborWavelength = 
  Flatten[ConstantArray[
    Table[Norm[wavelength[[i]]], {i, 1, Length@wavelength}], 
    Length@orientation]];
K = 3;
gabormagfiltered = gabormag;
Table[
  sigma = 0.5 gaborWavelength[[i]];
  gabormagfiltered[[i]] = GaussianFilter[gabormag[[i]], K sigma]
  , {i, 1, Length@gabormag}];

After this, I am stuck on how to use this filtered images to get the final classification.

How can I proceed?

Let’s block ads! (Why?)

Recent Questions – Mathematica Stack Exchange