0
$\begingroup$

It's well known that convolution in the spatial domain is equivalent to multiplication in the frequency domain. i have multiplied the Fourier transform of an image F with H. where H is the FT of a Gaussian function generated by the following code:

function H = gaussian_kernel(size, sigma)

    half_size = floor(size/2);
    [u,v]=meshgrid(-half_size:half_size,-half_size:half_size);
    H = exp(-(u.^2+v.^2) ./ (2 * sigma^2));
end

and the size of H is equal to the size of the image. my question is how to estimate h which is the blurring in spatial domain given that the FT of the gaussian is gaussian.

$\endgroup$
  • $\begingroup$ Try to FT your gaussian before multiplying. Phase is important. Then do an inverse fft (,,ifft'' in matlab). $\endgroup$ – user7358 Jan 4 '14 at 13:39
1
$\begingroup$

Suppose in time domain a Gaussian kernel is expressed as:

f(x,y) = exp (-r.^2/r0.^2);

where r.^2 = x.^2 + y.^2;, r0 is the radius of the exp(-1) point. Then the 2D FFT should be:

F(u,v) = pi/r0.^2 * exp(-w.^2/w0.^2);

where w.^2 = u.^2 + v.^2; , w0 = 1/ (pi * r0);

As a result, I would change your function to:

function H = gaussian_kernel(size, sigma)

    half_size = floor(size/2);
    [u,v]=meshgrid(-half_size:half_size,-half_size:half_size);
    H = exp(-(u.^2+v.^2) ./ (2 * sigma^2));
    r0 = 2 * sigma^2 * pi^2;
    H = H * r0 * pi;
end

And,

H = gaussian_kernel(16, 2);
subplot(2,1,1),imagesc(H)  % frequency domain
subplot(2,1,2),imagesc(real(fftshift((ifft2(fftshift(H))))))  % time domain

result:

enter image description here

Suppose it is (-N/2+1 : N/2) /N * fs in the frequency axis (N is the sampling point number, and fs is the sampling rate), then it is supposed to be (0:N-1)/(N * fs) in spatial axis.

$\endgroup$
0
$\begingroup$

i would look at it from a more fundamental, continuous-time (or continuous-space) and continuous-frequency perspective. defining the Fourier Transform and inverse as:

$$ \mathfrak{F}\{x(t)\} = X(f) \triangleq \int_{-\infty}^{+\infty} x(t) e^{-i 2 \pi f t} dt $$

and inverse

$$ \mathfrak{F}^{-1}\{X(f)\} = x(t) = \int_{-\infty}^{+\infty} X(f) e^{i 2 \pi f t} df $$ ,

a nice transform pair to remember is

$$ \mathfrak{F} \left\{ e^{-\pi t^2} \right\} = e^{-\pi f^2} $$ .

use the scaling property of the Fourier Transform to relate how wide the gaussian in one domain is related to how wide the gaussian is in the other. you have to define how wide the extent of "blurring" is since the gaussian never really gets to zero.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.