Digital Image Processing using Fourier Transform in Python

Craig Chen
7 min readFeb 17, 2020
Figure (a): (from left to right) (1) Original image (2) With Gaussian Low Pass Filter (3) With Gaussian High Pass Filter. The original image in this post comes from OpenCV Github example.

Digital images are now part of our daily life. People can hardly live without it. Therefore, digital image processing becomes more and more important these days. How to increase the resolution of images or reduce noises of images are always hot topics. Fourier Transformation can help us out. We can utilize Fourier Transformation to transform our image information - gray scaled pixels into frequencies and do further process.

Today, I’ll talk about how to utilize Fast Fourier Transformation in digital image processing, and how to implement it in Python. The process flow is as following (from left to right):

  1. Implement Fast Fourier Transformation to transform gray scaled image into frequency
  2. Visualize and Centralize zero-frequency component
  3. Apply low/high pass filter to filter frequencies
  4. Decentralize
  5. Implement inverse Fast Fourier Transformation to generate image data

Let’s dive into each section to figure out the theory behind theses steps.

Fast Fourier Transformation

Figure (c): (From left to right) (1) Original image (2) FFT spectrum visual output (3) Centralized (4) Decentralized (5) Inverse FFT

Digital images, unlike light wave and sound wave in real life, are discrete because pixels are not continuous. That means we should implement Discrete Fourier Transformation (DFT) instead of Fourier Transformation. However, DFT process is often too slow to be practical. That is the reason why I chose Fast Fourier Transformation (FFT) to do the digital image processing.

Step 1: Compute the 2-dimensional Fast Fourier Transform.

The result from FFT process is a complex number array which is very difficult to visualize directly. Therefore, we have to transform it into 2-dimension space. Here are two ways that we can visualize this FFT result: 1. Spectrum 2. Phase angle.

Craig Chen

Quantitative Analyst / Data Scientist