www.gusucode.com > images 案例代码 matlab源码程序 > images/ApplyArrayOfGaborFiltersToInputImageExample.m

    %% Apply Array of Gabor Filters to Input Image
%  
%%
% Read image into the workspace.

% Copyright 2015 The MathWorks, Inc.

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