Monday, July 6, 2009

Activity 5: Fourier Transform Model of Image Formation

A. Familiarization with Discrete FFT

The FFT of a circle is shown below


Figure 1. Upper left: Image of a circle. Upper right: Its FFT.
Lower left: After using fftshift(). Lower right: After using fft2() twice.

fftshift() is needed to revert to the original configuration of the quadrants of the image since the output of fft2() has quadrants along the diagonal interchanged. After using fft2() twice, the original image is recovered except that it is inverted. The inversion is not obvious in the circle pattern hence it is also tested on other pattern such as "A" and the results are



Figure 2. Upper left: Image of the letter "A". Upper right: Its FFT.
Lower left: After using fftshift(). Lower right: After using fft2() twice.

B. Simulation of an Imaging Device

In particular, we simulated a lens in which case is just the circle in the above section. The "object" to be image is a "VIP" pattern shown below.


Figure 3. "VIP" pattern.

The simulation was tested for different circle radii and we obtained the following results



Figure 4. Top row: Circles of different radii. Bottom row: Corresponding images.

From figure 4, it can be seen that as radii increases (or equivalently, as aperture increases), the resolution of the image increases. The above basically demonstrates convolution.

C. Template Matching Using Correlation

The main idea is that if two patterns are similar, it will yield a high correlation. The following demonstrates how pattern recognition works in text images.


Figure 5. Left: Text image. Middle: The pattern to look for in which is the letter "A". Right: The output after getting the correlation.

The output in figure 5 shows peaks (i.e. the white dots) at the locations of the letter "A".

D. Edge Detection Using the Convolution Integral

The idea is the same as above, only that this uses a small template and this template is scanned throughout the image. For this part, the templates used are [-1 -1 -1; 2 2 2; -1 -1 -1], [-1 2 -1; -1 2 -1; -1 2 -1], [-1 -1 -1; -1 8 -1; -1 -1 -1] which are just a horizontal line, a vertical line and a spot respectively. Below are the result after using imcorrcoef() with the VIP image.


Figure 6. Left: After using horizontal line template. Middle: After using vertical line template. Right: After using spot template.

As explained in the above section, only those with similar pattern will have a high correlation. Notice in figure 6 that a horizontal line template will only highlight horizontal lines in the VIP pattern. The same goes with rest of the template. The spot template shows a relatively good output image since every point in the pattern can be considered as a spot.

For this activity I'll give myself a 10+. Though coding is relatively simple, doing it for several images is quite hard. And by the way, the techniques presented here are indeed useful. ^_^

1 comment:

  1. Hello Master. Amazing, I stumbled upon this blog because of google image! hahaha

    ReplyDelete