Apply 2D Gabor wavelet in Images
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi I want to apply 2D Gabor filter on images at four orientations (0, 45, 90, 135 degrees). The output for every pixel should be like a vector [m0 m45 m90 m135], where m is the magnitude of orientation at that angle. Can anyone help me with the code?
0 comentarios
Respuestas (1)
Naga
el 27 de Sept. de 2024
Hello Asim,
Below is a sample code to apply 2D Gabor filters to an image at four orientations (0, 45, 90, and 135 degrees) and store the magnitudes in a vector for each pixel.
I = imread('sample.jpg');
I = rgb2gray(I);
% Define Gabor filter parameters
wavelength = 4;
orientationAngles = [0, 45, 90, 135];
bandwidth = 1;
[m, n] = size(I);
magnitudeMatrix = zeros(m, n, numel(orientationAngles));
% Apply Gabor filter at each orientation
for i = 1:numel(orientationAngles)
gaborFilter = gabor(wavelength, orientationAngles(i), ...
'SpatialFrequencyBandwidth', bandwidth);
magnitudeMatrix(:,:,i) = imgaborfilt(I, gaborFilter);
end
for i = 1:numel(orientationAngles)
subplot(2, 2, i);
imshow(magnitudeMatrix(:,:,i), []);
title(['Orientation: ', num2str(orientationAngles(i)), '°']);
end
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!