2D Fourier Transform Applications and Properties

One property of Fourier Transformations is anamorphism. Since the FT space is in the inverse dimension of the original space, what is wide in one axis will become narrow in the spatial frequency axis. Anamorphism works independently on each axis, so you can expect that patterns with different dimensions along each axis will have a corresponding anamorphism on each axis.

AP186 ACT6 RESULTS.001
Figure 1. Tall Rectangle and its FT
AP186 ACT6 RESULTS.002
Figure 2. Wide Rectangle and its FT

As we can see from Figures 1 and 2, when the image is wide along one axis, it will become narrow in the FT axis, and vice versa. Now, let’s say we have two dots on the X axis, but we vary the length of the dots, what sort of FT will we get?

AP186 ACT6 RESULTS.003
Figure 3. A) FT of two close dots. B) FT of two far dots.

The FT on the left was made from an image of two dots close to each other. The FT on the right was made from an image after we increased the distance of the two dots from each other. As you can see, as you increase the distance of the two dots, the lines on the FT become closer.

Rotation also has an effect on the FT. First, let’s take the FT of a sinusoid with varying frequencies.

AP186 ACT6 RESULTS.004
Figure 4. A) FT of sinusoid with f = 4. B) FT of sinusoid with f = 10.

As you can see, a sinusoid with a lower frequency has lines that are farther apart. Accordingly, due to anamorphism this means the dots on the FT will be closer together. If we make the lines closer together, we expect the opposite for the dots on the FT. In real terms, this means the dots of the FT will tell you the frequency of the sinusoid.

Now, sinusoids have negative values. Digital images do not, since they are limited to 0-255, even for RGB images (each channel will have its own 0-255 value). If we want to simulate a real image of the sinusoid, we have to add a constant bias.

Figure 6. Top Row) The FT of a sinusoid. Bottom Row) The FT of a sinusoid with constant bias.
Figure 5. Top Row) The FT of a sinusoid with f = 4. Bottom Row) The FT of a sinusoid with frequency f = 4 and a constant bias.

As you can see, if we add a constant bias, there is an increase in the DC component, which is the average brightness of the image. The top row shows us that from the FT of a sinusoid as is, we would think that the sinusoid is a sum of sinusoids with two different frequencies. As a result of the constant bias, instead of having two dots on either side of the FT, there is only one easily visible dot on either side, which means that the frequency corresponding to that dot is more likely to be the real frequency of the sinusoid. This is helpful if you know that the signal you are analysing has negative values, such as those you get from interferograms, or if you know the signal is dirty or has frequencies you know are not really part of the true signal, so you can add a constant bias in order to get rid of those noise.

Figure
Figure 6. The FT of a sinusoid rotated 30 degrees.

If we rotate the sinusoid, we can see that the FT also rotates with the same angle. Similarly, let’s say we have a pattern from adding sinusoids together.

Figure 7. A combination of X and Y sinusoids and its FT.
Figure 7. A combination of X and Y sinusoids and its FT.

As you can see, the FT would also show frequencies along the X and the Y axis. If we also add rotated sinusoids to the combination:

Figure 8. Added rotated sinusoids to the combination and its corresponding FT.
Figure 8. Added rotated sinusoids to the combination and its corresponding FT.

As you can see, the FT also rotates correspondingly.

This means we can remove unwanted frequencies or enhance wanted frequencies of a given signal in the FT domain. We will utilize convolution to do this. The convolution of a dirac delta and a function f(t) results in the replication of f(t) in the location of the dirac delta. Hence, we can use this to clean up our signal or enhance our data.

Remember from Figure 3 that the FT of two dots on the X axis is a pattern of lines along the same axis, where the distance between the lines is inversely related to the distance of the two dots. If we replace the two dots with circles with varying radius, the FT is quite different.

Figure 9. Top Row) small circles and their FT. Bottom Row) big circles and their FT.
Figure 9. Top Row) small circles and their FT. Bottom Row) big circles and their FT.

As you can see, the smaller the circles in the image, the bigger the circle in FT. Correspondingly, larger circles result in a smaller circle in FT. This happens also for other shapes, such as squares.

Figure 10. Top Row) Small squares and their FT. Bottom Row) Big squares and their FT.
Figure 10. Top Row) Small squares and their FT. Bottom Row) Big squares and their FT.

Similarly, if you have two Gaussians with varying variance, you would expect an inverse effect in the FT.

Figure 11. Top Row) Gaussians with variance = 2 and their FT. Bottom Row) Gaussians with variance = 4 and their FT.
Figure 11. Top Row) Gaussians with variance = 2 and their FT. Bottom Row) Gaussians with variance = 4 and their FT.

As you can see in Figure 11, more dots along the X axis can be seen if you have a smaller variance in the gaussians. If you make the variance of the Gaussians larger, less dots can be seen along the X axis. Note that if you enhance the images further, the other dots can be seen if you increase the contrast.

Figure 12. Random dots convolved with an edge template.
Figure 12. Random dots convolved with an edge template.

Here we see the convolution of random ones (representing our dirac deltas), and an edge template (representing our function f(t)). As you can see, the edge templates are replicated on the random ones.

Figure 13. Top Row) Close evenly-spaced ones and its FT. Bottom Row) Far evenly-spaced ones and its FT.
Figure 13. Top Row) Close evenly-spaced ones and its FT. Bottom Row) Far evenly-spaced ones and its FT.

Again, we can see that the spacing of the dots inversly affect the image of the FT. Closely spaced dots will result in a grid with larger squares. Dots spaced farther will result in a grid with smaller squares.

Let’s try using what we know to clean up a signal. Here we have an image of an unprocessed fingerprint that we found online (link in the caption).

fingerprint_unprocessed
Figure 14. Unprocessed Fingerprint from http://hristoalexiev.blogspot.com/p/computer-vision.html

Importing this to Matlab and showing the FT in logscale, we can see that the FT is very noisy and there are a lot of unwanted frequencies that we need to remove. We show it in logscale because the values in our FT span several orders of magnitude.

Figure 15. The FT of the unprocessed fingerprint (in logscale)
Figure 15. The FT of the unprocessed fingerprint (in logscale)

We need to create a filter to better see the fingerprint. Notice that our fingerprint is most likely the bright circular shape near the center of the FT. Therefore, we just find the values that correspond to those brighter lines and enhance them, and setting all the lower values to zero. Our filter will then look like this:

Figure 16. The fingerprint filter
Figure 16. The fingerprint filter

Now if we convolve the filter with our unprocessed fingerprint, we should get an image of the fingerprint with clearer ridges.

Figure 17. The processed fingerprint
Figure 17. The processed fingerprint

As you can see, the fingerprint is not perfectly enhanced, but it’s much easier to see the fingerprint as compared to our original image.

We can also use FT to remove other sorts of features in an image. For example, below is an image of the Moon’s surface that was stitched from multiple images. You can see the lines where the images were stitched. Let’s try to remove it using our knowledge of Fourier Transforms.

Figure
Figure 18. Surface of the Moon. Image taken from http://www.lpi.usra.edu/lunar/missions/apollo/apollo_11/images/hi_res_vertical_lg.gif

Again, remember that our image in the FT probably has values spanning different orders of magnitude, so we should use the logscale of the FT.

Figure. FT of the lunar surface image
Figure 19. FT of the lunar surface image

Remember that vertical lines will translate to horizontal lines in the FT. Most likely, the unwanted features of our image are on the X and Y axis of the FT. So we make a filter of exactly that. Remember that the center of the image should be untouched since that affects the overall brightness of the image.

Figure 20. Filter for the lunar surface image
Figure 20. Filter for the lunar surface image

We then get the convolution of the filter and our image. The result is the image below.

hi_res_vertical_lg_processed
Figure 21. The final processed image of the surface of the Moon.

Notice that the lines are not as noticeable now. In fact, at first glance, you would not think this image is a composition of multiple images.

Similarly, what if we have a digital image of a painting on canvas? We can apply Fourier Transform to remove the canvas texture.

OLYMPUS DIGITAL CAMERA
Figure 22. The Painting on canvas

Again, we need to see the FT of the canvas to identify what we must remove.

Figure 23. FT of the canvas.
Figure 23. FT of the canvas.

Remember that the canvas looks like dots on the original canvas. So most likely, those bright dots refer to the canvas. So let’s make the filter covering those dots.

Figure 24. The Filter for the canvas
Figure 24. The Filter for the canvas

Now that we have our filter, we simply convolve it with our canvas and see if it works.

filtered_canvas
Figure 25. The filtered canvas.

As you can see, the texture of the canvas is reduced. If you enlarge the circles in our filter, the texture can be further reduced. If you want to see what the texture of the canvas looks like in our painting, we can invert the filter to remove the painting and leave only the canvas texture.

Figure 26. The canvas texture.
Figure 26. The canvas texture.

This is what the computer sees as the canvas based on our filter.

And that’s it! As you can see, 2D Fourier Transforms have a wide range of applications!

Grade: 10/10

Leave a comment