Why shift, take absolute value and perform log transform to the frequency spectrum of an image obtained by fft2 in MATLAB?

Viewed 242

I have to obtain the frequency spectrum of a grayscale image using FFT in MATLAB and plot the spectrum. I used fft2() and plotted the output.

I watched a tutorial on plotting frequency spectrum and in that, they perform fftshit(), take the absolute value, apply a log transformation, scale pixels using mat2gray() and then convert into uint8 before plotting the spectrum. im2uint8(mat2gray(log(abs(fft_shifted)+1)))

My question is, is that necessary to perform all those steps before plotting the frequency spectrum? I know fftshift() is used to center the spectrum around 0th frequency coefficient. What is the use of performing other functions?

I plotted the frequency spectrum without shifting, after shifting, and after applying the above-mentioned steps.

Outputs

After this, I have to apply a low pass filter to the grayscale image and compare frequency spectrums. (This is a homework question)

0 Answers
Related