Ask Your Question

how to extract gabor feature using opencv?

asked 2014-09-03 21:42:32 -0500

tidy gravatar image

Does the latest OpenCV version have the function to get this feature?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-09-04 00:21:09 -0500

berak gravatar image

updated 2014-09-04 02:46:15 -0500


you create a Gabor Kernel (beware, 3.0 docs only), then use it with filter2d .

cv::Mat kernel = cv::getGaborKernel(cv::Size(kernel_size,kernel_size), sig, th, lm, gm, ps);
cv::filter2D(src_f, dest, CV_32F, kernel);

(both in opencv2/imgproc/imgproc.hpp)

edit flag offensive delete link more


This is nice! Since when this function exists?

thdrksdfthmn gravatar imagethdrksdfthmn ( 2014-09-04 02:34:40 -0500 )edit

a good year or so.

berak gravatar imageberak ( 2014-09-04 02:47:09 -0500 )edit

What are you supposed to do with dest to get a feature out of it. I though you had to sum the squares of the pixel values to get the 'Gabor energy', however, this seems to loose the sign of the Gabor filter, see my question here:

_Robert gravatar image_Robert ( 2014-09-15 14:17:57 -0500 )edit

@_Robert, no idea, what you want from the energy, i.e i use the filtered dest img to get an lbp histogram (use it as an edge filter), [well a bank of 4 filters, and concatenate the resulting histograms]

berak gravatar imageberak ( 2014-09-15 14:25:04 -0500 )edit

@berak could you post somewhere a piece of code with getting lpb histograms? I don't know how to connect gaborFilter output with features extraction...

Araneo gravatar imageAraneo ( 2014-11-16 09:58:48 -0500 )edit

@Areano, maybe similar to this one ? (you'll probably want a more 'rectangular' grid for your iris example)

berak gravatar imageberak ( 2014-11-16 13:57:48 -0500 )edit

@berak thank you very much for your respone. Really appreciate it.

Araneo gravatar imageAraneo ( 2014-11-17 11:48:16 -0500 )edit

@berak in the begining, I want to apologize for disturbing you, but I have a question - It will be okay if I just replace your square grid to rectangular one? For example 16x8? I really don't get it. :(

Araneo gravatar imageAraneo ( 2014-11-17 12:05:23 -0500 )edit

@Araneo, yes, definitely , for your iris case you'd wnat/need a rectangular one.

berak gravatar imageberak ( 2014-11-17 12:11:23 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2014-09-03 21:42:32 -0500

Seen: 3,363 times

Last updated: Sep 04 '14