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.