# Different representations of frequency space of 2D image FFT

I'm learning images processing using FFT. In my test example provided below the input pixel values are clamped 0-1 (0-255), but I do eventually want to process floating point heightfield pixel values.

The software I'm using (Houdini v18) provides forward and inverse FFT functions and as a base line I can successfully convert an image to frequency space and back.

However when I look at the 2D representation of the frequency space it looks different to any examples I've found online.

Test image: This is the result of Houdini's FFT with zero frequencies at center (height offset is pixel intensity): The function returns 2x "images" representing real an imaginary values.

This however is the frequency space representation I find everywhere online: From what I understand the radial type FFT images represent frequency between 0-2PI in u and v and the pixel value is the magnitude. And that most images are offset so 0 is centered.

Do I need to convert the real and imaginary components to frequency and magnitude and plot those? If so how?

EDIT: My end goal is to apply radial pass filters to the FFT so I just need to apply any spacial transforms to get the FFT to that state.

• if you have FFT in complex numbers just treat it as 2D complex valued array and apply your mask on it and take iFFT, the second image as you mentioned is magnitute so it is real^2 + Imaginary^2, if you notice the first image does not have the crossing lines Jan 11 '20 at 15:45
• OK so the second image is more meant for visualization purposes and not needed to apply masks? Jan 13 '20 at 1:43
• no, you can not apply mask on this and get back correct results. even more, actually this image has gone through a second process. The actual magnitude image is dark everywhere except 1 central pixel because of normalization of 2d array into a gray scale image. the above image is log10 of magnitude values Jan 13 '20 at 9:36
• @MinSaad Thanks! None of the tutorials online state this so great info. I guess it's harder to show representations of non-normalized real/imaginary values in 2D form. if you add your comments as an answer I'll mark it as correct. Jan 14 '20 at 20:11
• OK thanks! I'll add Jan 15 '20 at 10:05

The second image you find online as you mentioned is magnitude and the first image must be either real part or the imaginary part (but not both). If you calculate complex value magnitude for each point, i.e. $$Mag_{i,j} = R_{i,j}^2 + I_{i,j}^2$$ you get something similar to the following image.

I = imread('cameraman.tif');
F = fft2(I);
F_Centered = fftshift(F);
Mag = abs(F);
imshow(Mag); but taking log10 harnesses the large magnititde of some frequency bins so for visulasation the normalization does not round them to zero.

imshow(log10(Mag),[]) Thus applying the filter on the above image which is only processed for visualization is not correct and inverse FFT of the values would not have much meaning.

To apply your filter you get the fft of the image, F(image) , then you need to make a same size mask image (all 1 and the frequency section you need to be removed must be zero, also remember symmetry feature of Fourier) and then apply do a element wise multiplication of fft values with this mask.

Also, I would suggest to watch this short lecture by Hoff on this subject:

https://youtu.be/02c6ohQV2TA