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

    %% Apply Single Gabor Filter to Input Image
% 
%%
% Read image into the workspace.

% Copyright 2015 The MathWorks, Inc.

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');