You are here : matlabImage Processinggabor

gabor() - Image Processing

g = gabor(wavelength,orientation) creates
a Gabor filter with the specified wavelength (in
pixels/cycle) and orientation (in degrees). If
you specify wavelength or orientation as
vectors, gabor returns an array of gabor objects,
called a filter bank, that contain all the
unique combinations of wavelength and orientation.
For example, if wavelength is a vector of length
2 and orientation is a vector of length 3, then
the output array g is a vector of length 6. To
apply the Gabor filters to an image, use the imgaborfilt function.g = gabor(___,Name,Value,___) creates an
array of Gabor filters using name-value pairs to control aspects of
Gabor filter design. If you specify a vector of values, the output
array g contains all the unique combinations
of the input values.


Syntax

g = gabor(wavelength,orientation) exampleg = gabor(___,Name,Value,___)


Example

Construct Gabor Filter Array and Apply to Input ImageOpen This Example
Create a sample image of a checkerboard.A = checkerboard(20);
Create an array of Gabor filters.wavelength = 20;
orientation = [0 45 90 135];
g = gabor(wavelength,orientation);
Apply the filters to the checkerboard image.outMag = imgaborfilt(A,g);
Display the results.outSize = size(outMag);
outMag = reshape(outMag,[outSize(1:2),1,outSize(3)]);
figure, montage(outMag,'DisplayRange',[]);
title('Montage of gabor magnitude output images.');

Construct Gabor Filter Array and Visualize Wavelength and OrientationOpen This Example
Create array of Gabor filters.g = gabor([5 10],[0 90]);
Visualize the real part of the spatial convolution kernel of each Gabor filter in the array.figure;
subplot(2,2,1)
for p = 1:length(g)
    subplot(2,2,p);
    imshow(real(g(p).SpatialKernel),[]);
    lambda = g(p).Wavelength;
    theta  = g(p).Orientation;
    title(sprintf('Re[h(x,y)], \\lambda = %d, \\theta = %d',lambda,theta));
end


Output / Return Value


Limitations


Alternatives / See Also


Reference