14
$\begingroup$

I have read this image:

enter image description here

taken its FFT (2D) and then Inverse FFT to get exactly the image back. Code is provided for reference:

imfft = fft2(photographer);
im = uint8(ifft2(imfft));

imshow(im); %Output is same image

But when I change the fourier and take only the real part,

imfft = real(fft2(photographer));
im = uint8(ifft2(imfft));
imshow(im);

I get an image like this (note that size change is irrelevant and only due to saving it from Matlab figure handler):

enter image description here

Can someone explain me the theory (maths) behind it? Thanks

$\endgroup$
15
$\begingroup$

Let's say your image is given by $I(x,y)$. Then its Fourier transform is given by $$ I^f(\omega_x,\omega_y) = \int_x\int_yI(x,y)e^{j\omega_xx}e^{j\omega_yy}dxdy $$

Now you take the real part and perform the inverse:

\begin{align} I_m(\alpha,\beta) &= \int_{\omega_x}\int_{\omega_y}\Re\left\{I^f(\omega_x,\omega_y)\right\} e^{j\omega_x\alpha}e^{j\omega_y\beta}d\omega_xd\omega_y \\ &= \int_{\omega_x}\int_{\omega_y}\Re\left\{\int_x\int_yI(x,y)e^{j\omega_xx}e^{j\omega_yy}dxdy\right\} e^{j\omega_x\alpha}e^{j\omega_y\beta}d\omega_xd\omega_y\\ &= \int_x\int_yI(x,y)\int_{\omega_x}\int_{\omega_y}\Re\left\{e^{j\omega_xx}e^{j\omega_yy}\right\} e^{j\omega_x\alpha}e^{j\omega_y\beta}d\omega_xd\omega_ydxdy \end{align}

You can clearly see that the inner integral is the 2D Fourier transform of $$ \cos(\omega_xx)\cos(\omega_yy) + \sin(\omega_xx)\sin(\omega_yy) $$ which is $$ \frac{1}{2}\left[\delta(x-\alpha)\delta(y-\beta) + \delta(x+\alpha)\delta(y+\beta)\right] $$

Substituting the result to $I_m$ yields $$ I_m(x,y) = \frac{1}{2}\left[I(x,y)+I(-x,-y)\right] $$

Of course in your case $x,y>0$, however the discrete Fourier transform assumes your signal is $N$-periodic and you get $$ I_m(x,y) = \frac{1}{2}\left[I(x,y)+I(N-x,M-y)\right] $$ where $N,M$ are the dimensions of your image. I think you can see now why you got that result.

$\endgroup$
  • $\begingroup$ Nice answer! +1 $\endgroup$ – Peter K. May 13 '16 at 18:04
  • 3
    $\begingroup$ I think you can see now why got that result. Yes. However, since this question hit the HNQ list, perhaps you would consider adding the final step for those coming in from less-mathematical inclined sites. $\endgroup$ – Mast May 14 '16 at 11:18
9
$\begingroup$

The result ThP provided can also be stated in very simple terms: If you have a data set which is purely real, its (inverse) Fourier transform will have Hermitian symmetry: If you find the value $z$ at position $(x,y)$, then you will find the complex conjugate value $z^*$ at the point-reflected position $(-x,-y)$ about the origin. Note that the origin here would be the center of Fourier-space. This can be reformulated, of course, if the DC component is not in the center of your FFT implementation. And this is what you see in your image: A point-reflected version is overlaying the true image - because you forced one space to be real valued.

This property is actually being used for accelerating magnetic resonance imaging (MRI) in some cases: MRI acquires the data directly in Fourier-space. Since an ideal MR image can be described by real values only (all excited magnetization vectors have phase 0), you only have to acquire half of the data space, which saves you half of the imaging time. Of course, MR images are not completely real valued due to the limiations of reality... but with a few tricks you can still use this technique advantageously.

$\endgroup$
  • 2
    $\begingroup$ I liked the simple way of stating same answer which ThP provided. And thanks for information about MRI. Didn't know about that. $\endgroup$ – Failed Scientist May 14 '16 at 0:59

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.