You are here : matlabImage Processingimgaborfilt

imgaborfilt() - Image Processing

[mag,phase]
= imgaborfilt(A,wavelength,orientation) computes
the magnitude and phase response of a Gabor filter for the input grayscale
image A. wavelength describes
the wavelength in pixels/cycle of the sinusoidal carrier. orientation is
the orientation of the filter in degrees. The output mag and phase are
the magnitude and phase responses of the Gabor filter.example[mag,phase]
= imgaborfilt(A,gaborbank) applies
the array of Gabor filters, gaborbank, to the
input image A. gaborbank is
a 1-by-P array of Gabor objects, called a filter
bank. mag and phase are
image stacks where each plane in the stack corresponds to one of the
outputs of the filter bank. For inputs of size A,
the outputs mag and phase contain
the magnitude and phase response for each filter in gaborbank and
are of size M-by-N-by-P.
Each plane in the magnitude and phase responses, mag(:,:,ind),phase(:,:,ind),
is the result of applying the Gabor filter of the same index, gaborBank(ind).[mag,phase] = imgaborfilt(A,wavelength,orientation,name,value,...) applies
a single Gabor filter using name-value pairs to control various  aspects
of filtering.Code Generation support:
Yes.MATLABĀ® Function Block support: No.


Syntax

[mag,phase]
= imgaborfilt(A,wavelength,orientation) example[mag,phase]
= imgaborfilt(A,gaborbank) example[mag,phase] = imgaborfilt(A,wavelength,orientation,name,value,...)


Example

Apply Single Gabor Filter to Input ImageOpen This Example
Read image into the workspace.I = imread('board.tif');
Convert image to grayscale.I = rgb2gray(I);
Apply Gabor filter to image.wavelength = 4;
orientation = 90;
[mag,phase] = imgaborfilt(I,wavelength,orientation);
Display original image with plots of the magnitude and phase calculated by the Gabor filter.figure
subplot(1,3,1);
imshow(I);
title('Original Image');
subplot(1,3,2);
imshow(mag,[])
title('Gabor magnitude');
subplot(1,3,3);
imshow(phase,[]);
title('Gabor phase');

Apply Array of Gabor Filters to Input ImageOpen This Example
Read image into the workspace.I = imread('cameraman.tif');
Create array of Gabor filters, called a filter bank. This filter bank contains two orientations and two wavelengths.gaborArray = gabor([4 8],[0 90]);
Apply filters to input image.gaborMag = imgaborfilt(I,gaborArray);
Display results. The figure shows the magnitude response for each filter.figure
subplot(2,2,1);
for p = 1:4
    subplot(2,2,p)
    imshow(gaborMag(:,:,p),[]);
    theta = gaborArray(p).Orientation;
    lambda = gaborArray(p).Wavelength;
    title(sprintf('Orientation=%d, Wavelength=%d',theta,lambda));
end


Output / Return Value


Limitations


Alternatives / See Also


Reference