Re: how to calculate gabor filter Convolution template



Dear superwind wang,

An easy way could be to determine an array that is as large
as the image, where the filter takes only a small portion
of this array. Then, do the convolution in the frequency
domain.

Suppose that your image is img. Make its dimensions odd.

siz = size(img);
[x,y]=meshgrid(1:siz(1),1:siz(1));
x0 = (siz(1)+1)/2;
y0 = (siz(2)+1)/2;
filt = 1/(2*pi*σ^2)exp[-1/2(((x-x0)+(y-y0))/σ)^2]exp[j2*pi*f
((x-x0)*cosθ+(y-y0)sinθ)];

ConvRes = real(ifft2(fft2(img).*fft2(ifftshift(filt)));

I hope this works well for you.

Best,

Chen
"superwind wang" <wangbing7928@xxxxxxx> wrote in message
<fvhbm4$l6v$1@xxxxxxxxxxxxxxxxxx>...
Dear All:
I use this gabor filter
G(x,y)= 1/(2*pi*&#963;^2)exp[-1/2((x+y)/&#963;)^2]exp[j2*pi*f
(xcos&#952;+ysin&#952;)] for image edge detection.
now i know the value of &#963;,f and &#952;,how can i calculate
the gabor template, in other words,when i use the
function
conv2(A,B,'same') to get the filtered image,how can i
choose the values of variable x and y to generate the
matrix B.
Please help me ,i am in trouble.
Thank you!


.


Quantcast