Tuesday, August 10, 2010

Transforming Using Fourier Transform: Math Behind the Image

The Fourier Transform (FT) is a very useful method for image processing. The FT transforms one axis into frequency domain. The idea is, if we know the signal that we want to isolate, we can manipulate the frequency domain much easier than adjusting the actual image. This way, we can remove noise and offsets and retain the desired signal.

To examine this method of processing, we can wait for the next activity which deals more on the properties of Fourier Transform. But from mathematical physics subjects, we know that the Fourier transform of the Fourier transform of x is x. So by manipulating the first Fourier transform, we can adjust the image by separating the signal and noise in the frequency domain.

One property we would like to see is the effect of an aperture on an image. This can be explored by convolving the Fourier transform of both the image and the aperture. So we take an image of the letters VIP made in Paint and take its Fourier transform. We now create an image of a circle with varying radii using Scilab and take its fftshift. Since the circle is already in Fourier space, we just need to shift it to put the circle aperture and the VIP Fourier Transformation into the same reference point. Now, we convolve them by per element multiplying the shifted aperture and the FT of the VIP. By Fourier Transforming once more the convolution, we arrive at the VIP image when seen through an aperture.

(a) (b) (c)

Figure 1: The effect of an aperture on the reconstruction of a Fourier Transform. The images show the effect of an aperture of radius (a) 1, (b) 0.5 and

We can now compare the effect of various radii to the image by producing a circle of radius 0.1, 0.5 and 1. We can see from figure 1 that as the aperture radius increases, the resolution of the VIP image increases. This is because data from the outer regions covered by the aperture does not contribute to the reconstruction of the image.

Now, we look at possible uses of the Fourier Transform. One of the uses is the correlation. Correlation is the convolution of a complex conjugate of the Fourier Transform of a function and the Fourier Transform of the pattern. By taking the correlation, we arrive at a value that determines the degree of similarity of the pattern and the function.

By using this knowledge, we can apply this to words with letters as patterns. So for example, let us take the sentence “THE RAIN IN SPAIN STAYS MAINLY IN THE PLAIN” taken from the movie musical My Fair Lady. And we use the letter A as a pattern. From this, we expect that the highest similarities will occur in the parts of the sentence with the letter A. As we can see in figure 2, this is exactly the case.

(a) (b) (c)
Figure 2: Correlation of the image of A to an image of a sentence. The statement (a) and the Letter (b) was correlated and the results were displayed (c).

Another useful technique is the edge detection. By using correlation, we can find the edges of an image. The idea is, if we use a pattern of an edge, its correlation with an image will show high correlations with the edges of the image. This will then provide a mapping of the edge of the image. Now, we can change the shape of the pattern to find certain edges of the image.

(a) (b) (c)
Figure 3: Edge Detection using (a) Horizontal line, (b) Vertical line and (c) a Dot.

As seen in figure 3, the type of pattern used in edge detection will affect the result. This is due to the similarity between the edge of the image and the pattern used. So a horizontal pattern will not recognize the vertical edges while a vertical pattern will not show the horizontal edge. To solve this, let us use a dot. As we can see, it clearly shows all edges with its high correlation with any orientation.

So from here, we can see various technique to which Fourier transform can help us transform an image and process it.