Ask questions about Gabor filter's parameters
2 views (last 30 days)
Show older comments
I am trying to implement a 2D Gabor filter, but I don't understand several parameters of this filter. For example, I use a general form of 2D Gabor filter like h(x, y, f, theta, sigma_x, sigma_y) = exp(-.5 * ( x_theta^2/sigma_x^2 + y_theta^2/sigma_y^2) * cos(2*pi*f*x_theta), i.e. a even symmetric Gabor filet.
The question is that what sigma_x and sigma_y mean? In most of the papers, what has been presented is just 'standard deviation' of the Gaussian envelope along x and y. OK, this confused me several days.
I read several codes about Gabor, this two parameters didn't directly determine the size of the filter. They are either processed as
if (isnan(SigmaX)==1) | isempty(SigmaX),
SigmaX = (3*sqrt(2*log(2)))/(2*pi*CtrFreq);
end
if (isnan(SigmaY)==1) | isempty(SigmaY),
SigmaY=sqrt(2*log(2))/(2*pi*tan(pi/8)*CtrFreq);
end
xlim=round(nstd*(SigmaX*abs(cos(Angle))+SigmaY*abs(sin(Angle)))); ylim=round(nstd*(SigmaY*abs(cos(Angle))+SigmaX*abs(sin(Angle))));
In this case, nstd is said to be length of impulse response. Don't know that.
or
sigmax = wavelength*kx;
sigmay = wavelength*ky.
Thus, I just wonder that how I can determine the size of the filter. And because of this, I have several other questions about wavelength and bandwidth. (Cause I don't have any background in signal processing)
For the second case I provided above, it use wavelength to multiply kx or ky. Why we cannot use sigma_x or sigma_y directly? What this wavelength mean? Is it the size of Gabor filter? What is that bandwidth mean? Is it the size of Gabor filter?
I implemented a simple program, but it seems not correct, as below
function [GR, GI, G] = yGabora(f, sigma_x, sigma_y, theta)
the = theta * pi/180; % Angular to degree.
% Rotation matrix
Rot = [ cos(the) sin(the);
-sin(the) cos(the)];
% Calculate gabor filter
for x=-sigma_u:1:sigma_u
for y=-sigma_v:1:sigma_v
% Calculate rotated position of Gaussian function
tmpRet = Rot*[x, y]';
xt = tmpRet(1);
yt = tmpRet(2);
h_even(x+sigma_u+1, y+sigma_v+1) = exp(-0.5* (xt^2/(sigma_u^2) + yt^2/(sigma_v^2))) * cos(2*pi*f*xt);
h_odd(x+sigma_u+1, y+sigma_v+1) = exp(-0.5* (xt^2/(sigma_u^2) + yt^2/(sigma_v^2))) * sin(2*pi*f*xt);
end
end
% Generate a complex unit.
j = sqrt(-1);
% Real part of G
GR = h_even;
% Imaginary part of G
GI = h_odd.*j;
% Gabor filter
G = GR + GI;
0 Comments
Answers (0)
See Also
Categories
Find more on Digital Filter Design in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!