Tuesday, July 7, 2009

Activity 5. Fourier Transform Model of Image Formation

A. Familiarization with Discrete FFT

A 128x128 image of a circle and letter 'A' was created using paint. The images was then loaded in Scilab using the imread() function. The images was then converted to grayscale images using the im2gray() function in Scilab. The Fourier Transform of the images was then computed using the fft() function incorporated in Scilab. Fourier Transform shift was then employed to the transformed images using the function fftshift(). The original images with their shifted images and transformed images are shown below.



The size of the transformed image differs from the original image. The transformed images' appearance is just the inverted original image.


B. Simulation of an Imaging Device

Images of a circle with different radii were generated using Microsoft paint. An image with the text 'VIP' was also created using paint. The images was then converted into gray scale images. The Fourier shift of the images of a circle was computed. The Fourier transform of the image with text was then computed. The Fourier Transform of the image with text and the Fourier shift of the images with a circle was multiplied. The Fourier transform of the product was then computed and the image of the absolute value of the Fourier Transform was generated. The images of the circle, text and transform is shown below.

For r=46:

For r=26:






The transformed image when r=46 is smoother than the transformed image when r=26.


C. Template Matching Using Correlation

A 128x128 image with text "THE RAIN IN SPAIN STAYS MAINLY IN THE PLAIN" and "A" was created using Paint. The font and font size of the images were held constant. The images were then converted into gray scale. The Fourier transform of the image with "A" was then computed and multiplied with the conjugate of the Fourier Transform of the image with the other text. The Fourier Transform of the product was then computed. The original images and the results are shown below.

The third image scarcely contain the text inside the original image.

D. Edge Detection Using Convolution Integral
Several matrices were generated and tested against the image with "VIP" text. The convolution of the image with the matrices was computed using the function imcorrcoef() in Scilab. The matrices with the convolution is shown below.

For matrix=[1 1 1; -2 -2 -2; 1 1 1]:


For matrix=[3 1 3; 3 1 3; 3 1 3]:


For matrix= [2 2 2; 2 3 2; 2 2 2]:


The text is clearest when a spot patterned matrix was used. The vertical lines of the text is more defined when the vertical patterned matrix was used. On the other hand, the horizontal lines of the text is more defined when the horizontal patterned matrix was used.

I grade myself 9/10 for completing this activity.

No comments:

Post a Comment