Login  Register

Re: FFT multiplication

Posted by Gluender-2 on Dec 25, 2008; 3:33pm
URL: http://imagej.273.s1.nabble.com/FFT-filter-conversion-to-real-space-tp3694163p3694167.html

>Dear All,
>
>I would like to take the opportunity to ask
>another question regarding Fourier operations. I
>would like to perform spatiotemporal image
>correlation in the Fourier domain because of
>speed and memory considerations.
>If I understand correctly, convolution of two
>images (i.e. correlation) in the spatial domain,
>equals mere multiplication of the Fourier
>transformed images in the frequency domain.

Well, not perfectly but nearly...

Convolution and correlation is not the same but they are quite similar.
You must take care of the differences:

1) Convolution is a commutative operation, correlation is not.
        k(rho) = [b(r) corr a(r)] != [a(r) corr b(r)] = kÝ(-rho)

        Ý stands for "complex conjugate" and can be ignored
        when dealing with images (that are real-valued signals).

2) The relations between convolution and corelation are
        k(rho) = b(r) corr a(r) = b(r) conv aÝ(-r)
        f(rho) = b(r) conv a(r) = b(r) corr aÝ(-r)

>However, when multiplying two FFT images, the
>resulting images is no longer expressed in polar
>coordinates and therefore cannot be transformed
>back by inverse FFT.

If you Fourier-transform an image b(r) = b(x,y),
then it results in a (generally complex-valued)
Fourier-spectrum in Cartesian coordinates B(f_r)
= B(f_x, f_y).

Of course, you may represent whatever
2-dimensional function in polar coordinates but
this has nothing to do with the
Fourier-transformation.

As far as I remember and for whatever reasons --
though displaying Fourier-spectra in Cartesian
coordinates -- IJ _numerically_ indicates the
spectral coordinates as polar coordinates. Please
correct me if I'm wrong or if this behavior has
been changed.
(Personally and for several reasons, I don't use
IJ's Fourier-transformation. Instead I use the
slower IJ-PlugIn FFTJ.)

>I tried FD Math correlate, but this operation
>requires two square images of fixed dimensions
>and I'm not sure if enlarging the canvas size
>goes without consequences for the correlation
>outcome.

You may add appropriate surrounding areas of
preferably constant gray-value to your images.
(Avoid any gray-level steps when doing so.)

FD-Math in fact is based on the Fourier-approach
and therefore requires square sized image with
side-length being a power of 2. This is due to
the implemented algorithm. Digital
Fourier-transformation of arbitrarily sized
images is much slower (the IJ-PlugIn FFTJ is able
to do just that).

>I have noticed that the latter operation appears
>to give a similar resulting image whether one
>uses the original images as input or the Fourier
>transformed.
>Could anybody please share on how to do this the right way?
>Many thanks in advance and best wishes,
>
>Winnok
>
>ps: the archives were unaccesible, so apologies if this is a duplicate query.

HTH
--

                   Herbie

          ------------------------
          <http://www.gluender.de>