Monday, July 7, 2008

..on fourier transform model of image formation

The Fourier Transform (FT) of an image is given by:



Below are 128x128 bitmap images of circles with different radius and letter A's in varying size.

























We apply discrete 2D FFT on these images. The output of the FFT is a complex number. Getting the modulus gives us the intensity.





Big Circle












Big A












Medium Circle













Medium A












Small Circle












Small A







Applying fftshift() gives us:






Big Circle












Big A












Medium Circle












Medium A













Small Circle












Small A







These images are consistent with the analytical FT of the circle. As the radius of the circle decreases, we clearly observe the airy disc. The same for the letter A. As the size decreases, the airy patterns becomes more distinguishable. Applying FFT twice on the image results to the original image, but as we notice for letter A, the resulting images are inverted.














































































Convolution

The convolution of two 2D function f and g is given by:



This could be represented as h=f*g. If F and G are the FT of f and g, respectively, then the convolution is just simply H=FG. Below are the convolution images between the word VIP and the circles of varying radius. The circle serves as the aperture. As the radius of the circle decreases, the aperture becomes smaller and the resulting image is blurred. The bigger the aperture, the sharper the image.











Aperture 1









Image 1









Aperture 2









Image 2









Aperture 3









Image 3







Correlation


The correlation of two 2D function f and g is given by:



This could be represented as p=fog. If F and G are the FT of f and g, respectively, then the correlation is just simply P=F.G. The correlation measures the similarity between the two functions. Some of its application are as follows:

Template Matching

Below are the correlation images between the sentence "THE RAIN IN SPAIN STAYS MAINLY IN THE PLAIN", and the letter "A" and the word "IN". We notice that the maximum in the resulting images occurs on the part of the sentence (image) where there is a presence of A or a form like A. Same is true for the word IN.























A











IN







Edge Detection

Below are images resulting from the convolution of VIP and a 3x3 matrix pattern of an edge such that the total sum is zero. The first is a horizontal, the second is a vertical, and the third is a spot pattern. Notice that for the first pattern, the horizontal edges of the image are highlighted. For the second pattern, it is the vertical edges that are highlighted. And for the spot pattern, all the edges are highlighted.





Horizontal Pattern











Vertical Pattern











Spot Pattern







I was able to finish the activity with the results consistent with what were expected. I think I deserve a 10.

No comments: