FFT Filtering

Filtering with large convolution kernels can be extremely time consuming. Fortunately, there is a better way to do filtering. The method uses something called a Fast Fourier Transform, or FFT. After an FFT is performed, the result doesn't look anything like the original image. If there are large but slow brightness variations in the original image, the FFT image looks brighter in the corners and around the edges. If there are very large, rapid brightness variations, the center of the image will look brighter. Usually the image looks like something out of a kaleidoscope.

This may not sound very useful, but FFTs can be reversed to get the original image back. And you can make changes to the FFT'ed image before you reverse it. If the right changes are made, the result will be a filtered image. Because the FFT rearranges the image so that rapidly changing features are in one place, and slowly changing features are in another, just about any filter can be easily applied.

Usually the filter shape is generated first – either by taking an FFT of a convolution kernel, or by directly generating a shape called a ”transfer function.” Then an FFT is taken of the image. Each pixel in the FFT'ed image is multiplied by the corresponding pixel in the filter array. The FFT is reversed and voila, you have a filtered image. Mathematically, the process is identical to kernel filtering; but the processing occurs much more quickly.

The big advantage of FFTs is their speed. Any filter, no matter how complicated, takes exactly the same amount of time. A second advantage is that the exact shape of the filter can be very carefully controlled to finely adjust the amount of blurring or sharpening. Often the filter shape is calculated using a "Butterworth" equation, but there are other ways to get the shape.