Home > Image Processing > 7. Properties of the 2D Fourier Transform

## 7. Properties of the 2D Fourier Transform

In the previous blog post we observed how the Fourier Transform helps us predict the result if light passes through a certain aperture.  For further familiarization, here are more examples of FFTs obtained from various 2D patterns:

 Figure 1. Fourier Transform of different aperture shapes. Top row (left to right): square, annulus (donut), square annulus, vertical slits, and two dots. Bottom row: the respective FFTs of the patterns.

Anamorphic property of the Fourier Transform

Another property of the Fourier Transform is that it enables us to find the frequencies of sinusoidal waves and project them on the Fourier space.  We can perform this in Scilab through the following implementation:

```nx = 100; ny = 100;
x = linspace(-1, 1, nx);
y = linspace(-1, 1, ny);

[X, Y] = ndgrid(x, y);

f = 2;                 // frequency
z = sin(2*%pi*f*X);

scf(0); imshow(z, []); // display in graphics window 0

FIgray = fft2(z);

scf(1); imshow(abs(fftshift(FIgray)), []);
```

We observe from the results in Figure 2, that the FFT locates the frequencies of the sinusoids and plots them along the axis along which the sinusoid propagates.  We can see from these (and the following examples) that 2D Fourier Transforms are always symmetrical.

 Figure 2. Fourier Transform of 2D sinusoids. Top row (left to right): sinusoids of frequencies f = 2, f = 4, and f = 8. Bottom row: respective FFTs of the sinusoids.

Extending this concept, we can try adding bias to these sinusoids with the implementation:

```z = sin(2*%pi*f*X) + 1;
```

This produces a new peak in the Fourier Transform located on the origin of the FFT image, which displays that it is calculated to be at frequency 0.

 Figure 3. Fourier Transform of the sinusoidal images with added constant bias.

To test with non-constant bias, we perform this on sinusoids of different frequencies added together. The implementation will be the following:

```f1 = 2;
f2 = 8;
z = sin(2*%pi*f1*X) + sin(2*%pi*f2*X);
```

We will find that the resulting Fourier Transform displays sets of peaks that tell of the frequencies of both sinusoids that were superimposed.

 Figure 4. Fourier Transform of superimposed sinusoids. Top row (left to right) F1 = 2 and F2 = 4, F1 = 2 and F2 = 8; F1 = 4 and F2 = 8; Bottom row: respective FFTs of the sinusoid combinations

Rotating these sinusoids can prove that the Fourier Transform results to peaks along the direction of propagation of the waves.  We use the following Scilab execution:

```theta = 30;
z = sin(2*%pi*f*(Y*sin(theta) + X*cos(theta)));
```

Figure 5 displays the result for 2D sinusoids rotated at angles 30, 45 and 60.

 Figure 5. Fourier Transform of rotated sinusoids. Top row (left to right): sinusoids tilted at angles 30, 45 and 60. Bottom row: respective Fourier Transforms of the sinusoids.

Operations between sinusoids can yield different results in the Fourier place.  We try to perform FFT on superimposed sinusoids (traveling perpendicular to each other, X and Y) upon addition, matrix multiplication and bitwise multiplication.  We carry these out in Scilab with the following instructions:

```z_sum = sin(2*%pi*f1*X) + sin(2*%pi*f2*Y);
z_prod = sin(2*%pi*f1*X) * sin(2*%pi*f2*Y);
z_bitw = sin(2*%pi*f1*X). * sin(2*%pi*f2*Y);
```

In Figure 6, we can find that the Fourier peaks appear in right angles to each other just us how the original sinusoids propagate.  Note that these set of images were not normalized unlike the previous images shown.  This is in order to clearly display the differences of results from the matrix and bitwise multiplications, which somehow display visibly similar output image if normalized.

 Figure 6. Fourier Transform of sinusoids traveling along the X and Y direction combined under different operations. Top row (left to right): sinusoids combined after performing addition, matrix multiplication and bitwise multiplication.  Bottom row: respective FFTs of the patterns.

The Fourier Transform of a superimposition of different rotated sinusoids depends on the frequencies and angles of the waves and the matrix operations applied on them.  Figure 7 displays FFT of the following combinations: a) addition of 2 perpendicular sinusoids and a sinusoid of angle 45; b.) bitwise multiplication of 2 perpendicular sinusoids and a sinusoid of angle 45; and c.) matrix multiplication of sinusoids of angles 30, 45 and 60.

 Figure 7. Fourier Transform of several rotated sinusoids produced out of different operations. Top row (left to right): addition, bitwise multiplication and matrix multiplication. Bottom row: respective FFTs of the sinusoid combinations.

We observe that the addition of several rotated sinusoids (of similar frequency) results to a set of peaks creating a circle on the Fourier plane.

From the our examples we witnessed that the Fourier Transform is able to find underlying patterns in images and matrices, in general.  If the image contains no recurring pattern, the FFT will speak the same.  Mental prediction of Fourier output is remarkable but requires diligent practice.  Good thing that modern technology now allows us to carry this out much easier with the latest tools in digital image processing.

For this section, I would rate myself 11 for the job well done. 🙂

———————————————————————————————–—————–————————————

References:
[1] Soriano, 2010. Properties of the 2D Fourier Transform. Applied Physics 186.
[2] Jepson, 2005. 2D Fourier Transforms. Introduction to Visual Computing. University of Toronto.
[3] Quantum Scientific Imaging, 2008. Interpret Fourier Transforms (FFT).