How to improve the result of the performance of the gabor filter

1 view (last 30 days)
feats=gabfilter(fn1,25,[0.05 0.1],[6 6]);

Answers (1)

Yusuf Suer Erdem
Yusuf Suer Erdem on 20 Nov 2021
Example below is a gabor filter example. When you change the wavelength and the orientation. You ll get images with different qualities.
.tif file
clc; clear; close all;
I = imread('board.tif');
I = rgb2gray(I);
wavelength = 4;
orientation = 90;
[mag,phase] = imgaborfilt(I,wavelength,orientation);
tiledlayout(1,3)
nexttile
imshow(I)
title('Original Image')
nexttile
imshow(mag,[])
title('Gabor Magnitude')
nexttile
  4 Comments
ASMA MOHAMMAD
ASMA MOHAMMAD on 21 Nov 2021
function Output = gabfilter(image,N,freq,partition)
stage = partition(1);
orientation = partition(2);
im = im2double(imread(image));
[W, H] = size(im);
for j = 1:orientation
Gr = Gabor(N,[0 j],freq,partition,1);
switch j
case 1
ima1 = ifft2(fft2(im).*fft2(im2double(Gr),size(im,1),size(im,2)));
case 2
ima2 = ifft2(fft2(im).*fft2(im2double(Gr),size(im,1),size(im,2)));
case 3
ima3 = ifft2(fft2(im).*fft2(im2double(Gr),size(im,1),size(im,2)));
case 4
ima4 = ifft2(fft2(im).*fft2(im2double(Gr),size(im,1),size(im,2)));
case 5
ima5 = ifft2(fft2(im).*fft2(im2double(Gr),size(im,1),size(im,2)));
case 6
ima6 = ifft2(fft2(im).*fft2(im2double(Gr),size(im,1),size(im,2)));
end
end
ima = zeros(W, H);
for p = 1:W
for q = 1:H
ima(p, q) = (minimum(ima1(p, q), ima2(p, q), ima3(p, q), ima4(p, q), ima5(p, q), ima6(p, q))) * 256/6;
end
end
Output = ima;
end
function index = minimum(a, b, c, d, e, f)
res = min(a, b);
res = min(res, c);
res = min(res, d);
res = min(res, e);
res = min(res, f);
switch res
case a
index = 1;
case b
index = 2;
case c
index = 3;
case d
index = 4;
case e
index = 5;
case f
index = 6;
end
end

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!