Clear Filters
Clear Filters

DFT and FFT of Image

52 views (last 30 days)
bigdog
bigdog on 8 Apr 2015
Answered: Aastha on 8 Aug 2024 at 9:05
Shift the Fourier transform so that it is centered around the middle of your figure and plot the absolute value of the shifted DFT. Then apply the log transform (log(1 + DFT)) and plot your result.
I know that I'm supposed to use fft2 and fftshift. I have the image and this is the code I have this far.
>> X = imread('granular_media.jpg');
>> X1 = double(X(501:700,1401:1600));
>> X2 = double(X(1:200,1:200));
I need to first compute the DFT of the 200x200 subimages that I created. Any help with this?
  1 Comment
JANITHA
JANITHA on 22 Jul 2024
DFT in image processing log of magnitude of FT

Sign in to comment.

Answers (1)

Aastha
Aastha on 8 Aug 2024 at 9:05
Hi,
I find that you are computing the DFT of the 200x200 sub-images that you have created.
Please follow the below steps to compute the centered Discrete Fourier Transform of the sub images
1. Compute the Discrete Fourier Transform using “fft2 function. fft2 function can be used to deal with 2D signals and can compute a 2D Discrete Fourier Transform.
2. Shift the Discrete Fourier Transform computed in step 1 using fftshift function. The function fftshift shifts the low frequency components to the centre and high frequency components to the edge and centres the Discrete Fourier Transform image.
3. Display the Discrete Fourier Transform as an image. You can apply log transformation on the abs value of the Discrete Fourier Transform.
4. Further, you can also add a small constant to prevent the argument of the log function from being zero and then plot it.
5. Steps 1-3 can be repeated for any image that you desire to compute the centered Discrete Fourier Transform.
I have attached an “fft_example.m” file that illustrates an example on how to compute Discrete Fourier Transform of an image.
Hope this helps!

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!