Fourier Descriptors

Fourier Descriptors are a way of encoding the shape of a two-dimensional object by taking the Fourier transform of the boundary, where every (x,y) point on the boundary is mapped to a complex number x + Sqrt[-1] y. The original shape can be recovered from the inverse Fourier transform. However, if only a few terms of the inverse are used, the boundary becomes simplified, providing a way to smooth or filter the boundary. In this demonstration, you can select from a variety of different shapes, and then reconstruct the shape from different numbers of the descriptors. When the number is small, the resulting reconstruction is greatly simplified; as the number increases the reconstruction converges to the original.
  • Contributed by: William Sethares


  • [Snapshot]


The Fourier Descriptors of a shape are calculated by:
(1) Find the coordinates of the edge pixels of a shape and put them in a list in order going clockwise around the shape.
(2) Define a complex-valued vector using the coordinates obtained from (1). For example: {3,4} -> 3+4j.
(3) Take the Discrete Fourier Transform of the complex-valued vector in (2).

Fourier descriptors inherit several properties from the Fourier transform:
(a) Translation invariance: no matter where the shape is located in the image the Fourier descriptors remain the same.
(b) Scaling: if the shape is scaled by a factor, the Fourier descriptors are scaled by that same factor.
(c) Rotation and starting point: Rotating the shape or selecting a different starting point only affects the phase of the descriptors.

Because the discrete Fourier transform is invertible, all the information about the shape is contained in the Fourier descriptors. A common thing to do with Fourier descriptors is to set the descriptors corresponding to values above a certain frequency to zero and then reconstruct the shape. The effect of this is a low pass filtering of the shape, smoothing the boundary. Since many shapes can be approximated with a small number of parameters, Fourier descriptors are commonly used to classify shapes.
The slider let's you choose how many terms to use in the reconstruction. With more terms, the shape looks more like the original. With fewer terms, the shape becomes smoother and rounder.