Ask Your Question
1

getGaborKernel and complex values

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

Bau Miao gravatar image

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

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?!

thanks...

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

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

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

to:

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

Comments

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 -0600 )edit
2

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 -0600 )edit

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

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

Question Tools

Stats

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

Seen: 2,499 times

Last updated: Jun 26 '14