Gabor filter 2D

Generate a spatial gabor filter (2D)
826 Downloads
Updated 2 Mar 2015

View License

gabor_filter = gabor2D(w, theta, sigma, size, type)
w : central frequency
theta : angle or orientation (degree)
sigma : sigma value of Gaussian envelope (usually choose = 1/w)
size : size of output filter in pixel (size*size)
type : 'even' or 'odd', default: 'odd';
'even' : real part of gabor filter
'odd' : imaginary part of gabor filter
---------------------------------------------
Example
Assume you want to filter the central frequency 32 of the image size
320*240 with filters size 31x31. It may be:
w = [2 4 8 16 32 64];
w = w/(320/31); % scale central frequency
theta = [0 45 90 135];
sigma = 1./w;
size = 31;
type = 'even';
g = gabor2D(w(5), theta(1), sigma(5), size, type);
showGabor(g);
** showGabor function just visualizes the output of gabor2D.

Cite As

Minh Nguyen (2026). Gabor filter 2D (https://www.mathworks.com/matlabcentral/fileexchange/49888-gabor-filter-2d), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Filter Banks in Help Center and MATLAB Answers
Version Published Release Notes
1.0.0.0