# Why real part of FFT converts image into rotation + original?

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):

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

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.

• 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.
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.