%% Gabor Filter for Image Processing

% Load the image
img = imread('landscape.jpg');
img = rgb2gray(img);

% Define the Gabor filter parameters
lambda = 8; % Wavelength of the carrier signal
theta = 0; % Orientation of the filter (in degrees)
sigma = 4; % Standard deviation of the Gaussian envelope
gamma = 0.5; % Spatial aspect ratio
psi = 0; % Phase offset of the filter

% Create the Gabor filter
gabor_filter = gabor2(lambda,theta,sigma,gamma,psi);

% Filter the image in the vertical direction
img_vertical = imfilter(img,gabor_filter,'symmetric','conv');

% Filter the image in the horizontal direction
img_horizontal = imfilter(img,gabor_filter','symmetric','conv');

% Filter the image in the combined direction
img_combined = imfilter(img,gabor_filter,'symmetric','conv');
img_combined = imfilter(img_combined,gabor_filter','symmetric','conv');

% Show the original and filtered images
subplot(2,2,1);
imshow(img);
title('Original Image');
subplot(2,2,2);
imshow(img_vertical);
title('Vertical Filtered Image');
subplot(2,2,3);
imshow(img_horizontal);
title('Horizontal Filtered Image');
subplot(2,2,4);
imshow(img_combined);
title('Combined Filtered Image');
MATLAB Gabor 滤波器:风景画图像处理

原文地址: https://www.cveoy.top/t/topic/nDUV 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录