Ask Your Question

How to use Gabor Filter using Opencv Java API

asked 2015-05-08 06:30:23 -0500

RB gravatar image

i want to use Gabor filter usin gopencv with java API. i referred to the docs, and it is as follows:


 public static Mat getGaborKernel(Size ksize,
                             double sigma,
                             double theta,
                             double lambd,
                             double gamma,
                             double psi,
                             int ktype)

my problem is that i do not know how to specify the parameters, for an exampel, the Size, should it be the size of the image or what?

please provided brief explanation concerning how to use the parameters.

edit retag flag offensive close merge delete



stolen from here:

  • ksize Size of the filter returned.
  • sigma Standard deviation of the gaussian envelope.
  • theta Orientation of the normal to the parallel stripes of a Gabor function.
  • lambda Wavelength of the sinusoidal factor.
  • gamma Spatial aspect ratio.
  • psi Phase offset.
  • ktype Type of filter coefficients. It can be CV_32F or CV_64F.
berak gravatar imageberak ( 2015-05-08 06:58:36 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-08-14 19:08:04 -0500

pankra gravatar image

updated 2015-08-14 19:09:51 -0500

ksize - si the size of the window, not the entire matrix. i.e. 17x17, 21x21, ... always odd number.
lambda - wavelenght, the thickness of the wave. can be 10, 15, 20, 30 or whatever you want.
sigma - standard deviation. it's defined like X*lambda, 0< X < 1. But you also can asign any number.
theta - is the orientation (in degrees) of your filter. can be 0 to 360.
gamma - is de width of the wave (elipticity). between 0.02 and 1. 1 is round, 0.02 is practically a line.
psi - is the offset of phase(in degrees). can be 0, 90, -90, 180, -180. if you want the wave to process the image as it. is, you should asign 0.
ktype - is CvType.CV_32F or CvType.CV_64F.

edit flag offensive delete link more

Question Tools



Asked: 2015-05-08 06:30:23 -0500

Seen: 1,392 times

Last updated: Aug 14 '15