http://imagej.273.s1.nabble.com/FFT-filter-conversion-to-real-space-tp3694163p3694171.html
(?). The resulting image (+ swap quadrants) corresponds with the one
generated by FD Math as well as Bob's convolve 3D plugin. The latter
actually runs very fast and works on rectagular images. Thanks for
your patience and detailed explanation.
>> Thank you very much for your well documented response.
>> So in summary, squaring the canvas (e.g. black fill) and using FD Math
>> correlate on the original images should return relatively reliable data.
>
> That's what I would expect.
> The color of the "fill" depends on the kind of your images.
>
>> I know the polar coordinates are just a representation, but how does one
>> convert an image (for instance after multiplying these two FFT
>> images=correlation) back to such representation in order to be able to
>> perform the inverse Fourier transform?
>
> OK, first of all here is what concerns the spectral "multiplication":
>
> 3) What does remark 2) mean for spectral functions?
>
> b(r) conv a(r)
> | |
> FT FT
> | |
> B(f_r) * A(f_r)
>
>
> [ b(r) corr a(r) ] = [ b(r) conv aÝ(-r) ]
> | | | |
> FT FT FT FT
> | | | |
> [ B(f_r) * AÝ(f_r) ] = [ B(f_r) * AÝ(f_r) ]
>
> * stands for multiplication and
> Ý stands for "complex conjugate"
>
> Because the Fourier-transforms of your images are most likely
> complex-valued, you must take care of the the "complex conjugate"
> AÝ(f_r)!
>
> A(f_r) = Re{ A(f_r) } + i * Im{ A(f_r) };
> AÝ(f_r) = Re{ A(f_r) } - i * Im{ A(f_r) };
>
>
>
> 4) How to multiply complex numbers cz = cx * cy ?
>
> cx = rx + i ix;
> cy = ry + i iy;
>
> cz = cx * cy = (rx * ry - ix * iy) + i(rx * iy + ry * ix) = rz + i iz;
>
>
> With this in mind, you have do perform the Fourier-transforms of your
> images that result in 2 spectral components each (real and imaginary
> parts). Then you do the complex multiplication taking into account the
> "complex conjugate" of the spectrum of one of your images. Finally you
> do a Fourier-retransform of the resulting complex "product"-spectrum
> which should result in a real-valued image (but it wont!). That's all.
>
> I just checked this procedure with FFTJ and it works perfectly!
>
>
>> I checked out FFTJ as well, but it indeed is far slower, just what I wanted
>> to circumvent.
>> Best regards,
>> Winnok
>
>
> HTH further
>
> Herbie
>
> ------------------------
> <
http://www.gluender.de>
>
>
>
>> >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>
>>
>> No virus found in this incoming message.
>> Checked by AVG.
>> Version: 7.5.552 / Virus Database: 270.10.0/1861 - Release Date: 22/12/2008
>> 11:23
>>
>>
>> No virus found in this outgoing message.
>> Checked by AVG.
>> Version: 7.5.552 / Virus Database: 270.10.0/1861 - Release Date: 22/12/2008
>> 11:23
assistent prof. P. Van Oostveldt
Dep. Moleculaire Biotechnologie
Fac. Toegepaste Landbouwwetenschappen, Ugent
tel. (0032) 09/264.59.71