Ask Your Question

getGaborKernel and complex values

asked 2014-06-26 03:22:15 -0500

Bau Miao gravatar image

updated 2014-06-26 03:35:34 -0500

I need to generate a gabor Kernel, and for this purpose I use the getGaborKernel function.

But it seems that this function return me a kernel with real values, while i need a Gabor kernel with complex values.

How do I obtain this?! There is another function, or there are some parameters that give me complex values as result?!


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-06-26 08:30:55 -0500

According to the source code of the getGaborKernel() function (see here or refer to the source of OpenCV 2.4.9), it only returns the real part of a Gabor filter (see more at Gabor filter at wiki). For the imaginary part, you can change the source code line from:

double v = scale*std::exp(ex*xr*xr + ey*yr*yr)*cos(cscale*xr + psi);


double v2 = scale*std::exp(ex*xr*xr + ey*yr*yr)*sin(cscale*xr + psi);

and return the Mat object containing all the needed values.

edit flag offensive delete link more


guess you mean to actually add the v2 line and compute both instead of changing it, or am I wrong?

Guanta gravatar imageGuanta ( 2014-06-26 08:53:35 -0500 )edit

I mean to write another function of the same code, except the line above, to return the imaginary part or, a little bit harder, in the same function, but return a Mat object of two channels: one for the real part, the other for the imaginary part.

tuannhtn gravatar imagetuannhtn ( 2014-06-26 08:56:53 -0500 )edit

Hey, it is exactly what I need... Thanks a lot!

Bau Miao gravatar imageBau Miao ( 2014-07-01 10:32:55 -0500 )edit

Question Tools


Asked: 2014-06-26 03:22:15 -0500

Seen: 1,943 times

Last updated: Jun 26 '14