Fourier transform is a mathematical method where you convert information from a certain dimension to another. It is a linear transform where a signal in dimension x is converted to a signal in dimension 1/x. There are a lot of ways to implement a Fourier transform. One of the known way is the Fast Fourier Transform by Cooley and Tukey. There are function in Scilab that does it: fft() for a 1-D signal and fft2 for 2D-signal.
In this activity we would demonstrate Fourier transform on images. First we make a 128X128 image of a circle with a black background. Figure 2 shows the Image after performing the Fast Fourier Transform(FFT). Notice that the white parts on the side?
|
Figure 1. A circle generated using Paint |
|
Figure 2. The circle after Fourier Fast Transform
|
This happens because once you perform a FFT, the quadrants are inversed. For better illustration; look at Figure 3. The code used for the FFT is shown in Figure 4.
|
Figure 3. The original image(left) and the image after FFT where the quadrants are inversed. |
|
Figure 4. The code used for using FFT on the image.
We can shift the quadrant back to its proper place by using the command imshow(fftshift(abs(FIgray))), []); which was used in the code in Figure 6. |
|
Figure 5. Image after shifting the quadrants of figure 2 to its proper place
|
Figure 6. Code used for putting the quadrants back to its proper place.
Now we can inverse the transform we used by using another FFT.
imshow(abs(fft2(fft2(Igray))));
|
Figure 7.The image after using another FFT on figure 5.
|
Looking at Figure 7; it may look like the original circle but it is already inverse of the original. image. We can see it more clearly by doing the same things done on the circle to the image with the letter 'A'.
|
Figure 8. Image of letter 'A' generated using Paint |
|
Figure 9. The letter 'A' after Fourier Fast Transform |
|
Figure 10. Image after shifting the quadrants of figure 9 to its proper place |
|
Figure 11. The image after using another FFT on figure 10 |
We can see more clearly on Figure 11; that the original image is inverted after using another FFT on the image.
On the next part of the activity we investigate the concept of convolution.
Convolution Method
Convolution is like smearing two functions such that the resulting image looks a bit like each of the individual function. The convolution of two 2D function f and g is given by the integral:
Simulation of an imaging device Convolution Method
First we simulate an imaging device by varying its 'aperture' and convolving it with the VIP image. The circle here would be our aperture and we would multiply it to the VIP image. The circle here would serve as the aperture of the lens used in the camera. We know that the quality of photos taken by a camera is dependent on the aperture of the lens. The Simulation was done by using the code in figure 14. Notice that when you increase the aperture, the quality of the image improves. We can also observe that when the aperture becomes so small, the quality of the image greatly deteriorates.
|
Figure 12. VIP letters generated using Paint |
|
Figure 13. The first 'aperture' of the lens |
|
Figure 14. The code used for 'combining' the aperture and the VIP image. |
Walang komento:
Mag-post ng isang Komento