Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Forward and Inverse Fourier Transform of an Image in MATLAB

  • Difficulty Level : Expert
  • Last Updated : 28 Jan, 2022

In this article, we shall apply Fourier Transform on images. Fourier Transform is a mathematical technique that helps to transform Time Domain function x(t) to Frequency Domain function X(ω). In this article, we will see how to find Fourier Transform in MATLAB.

Properties of Fourier Transform:

  • Linearity: The addition of two functions corresponding to the addition of the two frequency spectrum is called linearity. If we multiply a function by a constant, the Fourier transform of the resultant function is multiplied by the same constant. The Fourier transform of the sum of two or more functions is the sum of the Fourier transforms of the functions.
  • Scaling: Scaling is the method that is used to change the range of the independent variables or features of data. If we stretch a function by the factor in the time domain then squeeze the Fourier transform by the same factor in the frequency domain.
  • Differentiation: Differentiating function with respect to time yields to the constant multiple of the initial function.
  • Convolution: It includes the multiplication of two functions. The Fourier transform of a convolution of two functions is the point-wise product of their respective Fourier transforms.
  • Frequency Shift and Time Shift: Frequency is shifted according to the coordinates. There is a duality between the time and frequency domains and frequency shift affects the time shift. The time variable shift also affects the frequency function. The time-shifting property concludes that a linear displacement in time corresponds to a linear phase factor in the frequency domain.

The image chosen for the experiment in this article is a famous cameraman image.

Figure: Input image

Equation for DFT: X(k) = \sum_{n=0}^{N-1}\ x[n].e^{\frac{-j2\pi kn}{N}}

Equation for IDFT: x(n) = \sum_{k=0}^{N-1}\ X[k].e^{\frac{j2\pi kn}{N}}


  • Read the image.
  • Apply forward Fourier transformation.
  • Display log and shift FT images.

Function Used:

  • imread( ) inbuilt function is used to image.
  • fft2( ) inbuilt function is used to apply forward fourier transform on 2D signal.
  • ifft2( ) inbuilt function is used to apply inverse Fourier transform on 2D signal.
  • fftshift( ) inbuilt function is used to shift corners to center in FT image.
  • log( ) inbuilt function is used to evaluate logarithm of FT complex signal.
  • imtool( ) inbuilt function is used to display the image.



% MATLAB code for Forward and 
% Inverse Fourier Transform
% Apply fourier transformation.
% Take magnitude of FT.
% Take log of magnitude of FT.
% Shift FT from corners to central part.
% Display all three FT images.
% Remove some frequency from FT.
f(1:20, 20:40)=0;



Figure 1:Absolute of the fourier transformed image

Figure 2: Log of the absolute of FT of image

 Figure 3:Centered spectrum of FT image

Figure 4: Some frequencies blocked in FT image

Code Explanation:

  • k=imread(“cameraman.jpg”); This line reads the image.
  • f=fft2(k); This line computes fourier transformation.
  • f1=abs(f); This takes magnitude of FT.
  • f2=log(abs(f)); This line takes log of magnitude of FT.
  • f3=log(abs(fftshift(f))); This line shifts FT from corners to central part.
  • f(1:20, 20:40)=0; This line remove frequencies from FT.



% apply inverse FT on FTransformed image.
% we get original image in this step.
% Take log of original image.
% Shift corners to center.
% Again shift to get original image.
% Remove some frequency from FT image.
f(1:20, 20:40)=0;
% Apply inverse FT.
% Display all 4 images.
imtool(j3,[]);%j and j3 are same.



Figure 1:Original Input Image was obtained by taking the Inverse FT of the FT image


Figure 2: log of absolute Inverse Fourier Transformed Image


Figure 3: Corners shifted to center


Figure 4: Inverse FT after removing some frequencies from Freq Domain

Code Explanation: 

  • j=ifft2(f); This line computes inverse FT of FT image.
  • f(1:20, 20:40)=0; This line removes some frequency from FT image.
  • j4=ifft2(f); This line computes inverse FT after removing some frequencies.
  • imtool(abs(j4),[]); This line displays modified image which contains some ringing artefacts.


  • There is no one-to-one correspondence between the cameraman image and the Fourier transform image.
  • The cameraman image represents the intensities in the spatial domain.
  • Fourier transformed image represents frequency in the frequency domain.
  • Lower frequency represents the smooth part of the image while higher frequency represents the shape components like edges of an image.
  • If the low-frequency part is removed from the frequency domain image then the spatial domain image will get blurred.
  • If the anyone frequency value is removed (made 0) in the frequency domain image, that particular frequency will be removed (subtracted) from every intensity value in the spatial domain image.


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!