tebesir
Newbie level 2
hi friends;
i have some problems about Gabor filters. i wrote codes for the Gabor filter given below. but my results are not as same as the results in this link, **broken link removed**.
could you please write me what my mistakes are.
Thanks a lot for your helps.
The Gabor Codes:
theta=input('theta between 0-360='); theta
lamda=input('wavelength=');
if lamda<2
fprintf 'invalid value(it must be >= 2)'
lamda=input('lamda=');
end
lamda % lamda = 1/spat. freq (lamda --> pixel/cycle, freq --> cycle/pixel)
b=input('bandwidth='); % octave
sigma=(lamda/(pi))*(sqrt((log(2))/2))*(((2^b)+1)/((2^b)-1)); %standard deviation
sx=sigma, sy=sigma
for x=-fix(sx) : fix(sx) % for row
for y=-fix(sy) : fix(sy) % for coloumn
xp=x*cosd(theta)+y*sind(theta); % x'
yp=-x*sind(theta)+y*cosd(theta); % y'
G(x+fix(sx)+1,y+fix(sy)+1)=exp(-((xp^2)+(yp^2))/(2*sigma^2))*cos(((2*pi*xp/lamda))+pi/2);
end
end
G
RGB = imread('lena.jpg'); % RGB image
I = rgb2gray(RGB); % make it grayscale(intensity)
if isa(I,'double')~=1 % make it double
I =double(I);
end
Imgabout = conv2(I,double(imag(G)),'same');
Regabout = conv2(I,double(real(G)),'same');
gabout = sqrt(Imgabout.*Imgabout + Regabout.*Regabout);
subimage(uint8(I)), title('Original Image');
figure, subimage(uint8(gabout)), title('Filtered Image')
i have some problems about Gabor filters. i wrote codes for the Gabor filter given below. but my results are not as same as the results in this link, **broken link removed**.
could you please write me what my mistakes are.
Thanks a lot for your helps.
The Gabor Codes:
theta=input('theta between 0-360='); theta
lamda=input('wavelength=');
if lamda<2
fprintf 'invalid value(it must be >= 2)'
lamda=input('lamda=');
end
lamda % lamda = 1/spat. freq (lamda --> pixel/cycle, freq --> cycle/pixel)
b=input('bandwidth='); % octave
sigma=(lamda/(pi))*(sqrt((log(2))/2))*(((2^b)+1)/((2^b)-1)); %standard deviation
sx=sigma, sy=sigma
for x=-fix(sx) : fix(sx) % for row
for y=-fix(sy) : fix(sy) % for coloumn
xp=x*cosd(theta)+y*sind(theta); % x'
yp=-x*sind(theta)+y*cosd(theta); % y'
G(x+fix(sx)+1,y+fix(sy)+1)=exp(-((xp^2)+(yp^2))/(2*sigma^2))*cos(((2*pi*xp/lamda))+pi/2);
end
end
G
RGB = imread('lena.jpg'); % RGB image
I = rgb2gray(RGB); % make it grayscale(intensity)
if isa(I,'double')~=1 % make it double
I =double(I);
end
Imgabout = conv2(I,double(imag(G)),'same');
Regabout = conv2(I,double(real(G)),'same');
gabout = sqrt(Imgabout.*Imgabout + Regabout.*Regabout);
subimage(uint8(I)), title('Original Image');
figure, subimage(uint8(gabout)), title('Filtered Image')