Mga Pahina

Linggo, Agosto 11, 2013

Enhancement in the Frequency Domain

It's been so long since the last time I have posted my results here. I figured out it's rather more difficult to write about a certain topic that is long overdue because the idea and the hype about it is not that  fresh anymore. Anyway, the idea here is to enhance an image using the frequency domain. If we are given an image with unwanted repetitive patterns and we want to remove them, the straightforward thing to do is to create filter masks that will block the unwanted frequencies. The key points behind this are the idea of the convolution theorem, and these are the following [1]:
1. The Fourier Transform of a convolution of two functions in space is just the product of their Fourier transforms. That is, 
2. The convolution of a dirac delta function and a particular function is the replication of that function to the location of the dirac delta. That is,

So to start with, I obtained the fourier transform of an image with two points separated and symmetric about the y-axis and the result is a sinusoid as shown in the following figure.
Figure 1. FT of two dots (one pixel each) separated and symmetrical to the y-axis

Suppose we increase the number of pixels and create a circular pattern of a certain radius r and the Fourier transform is applied, we should get the following result for different radius.
Figure 2. Increasing radius and their corresponding FT

As you increase the radius, the size of the airy pattern formed decreases. The FT of the circle with radius 1 appear almost the same as that of Figure 1, only the shade shows some curvature at the sides. This is because the resulting image is the product of the airy pattern and the sinusoid. The FT of the two dots is just the sinusoid alone. 
As for the FT of the two square symmetric at the center, the FT should be the product of the sinc function and the sinusoid. The increase in the width of the square resulted to the decrease in size of the pattern formed.
Figure 3. Increasing width of the square and their corresponding FT

Meanwhile, the same pattern is observed when the squares are replaced with a gaussian pattern. The effect of the increase in variance is shown in Figure 4. The same with the symmetrical squares and circles, the FT of the two symmetrical gaussian is a combination of the FT of gaussian and a sinusoid. Since the FT of a gaussian is also a gaussian of different form (different parameters), the result shows an image of another gaussian pattern with a sinusoid pattern. The increase in the variance results to the increase in size of the gaussian image, and consequently the decrease in the size of the corresponding FT.

Figure 4. FT of two symmetric gaussian about the center with increasing variance


To evaluate the effect of idea number 2 of the convolution theorem, I created 10 dots placed randomly on an array of zeros. These represents the dirac delta functions. I also created different patterns of stars of different sizes. Then, I took the convolution of the two functions and obtained the following result.
Figure 5. top: pattern convolved with the randomly placed dirac delta and their (bottom) corresponding results

As stated from number 2 above, the pattern was replicated to the locations of all the dirac delta functions. For the case of the last column in Figure 5, the pattern was too big, so the result is an overlapping images of the same pattern.

Now, let's go to the actual application of these concepts. Given an image of the craters of the moon from the NASA Lunar Orbiter, the goal is to remove the horizontal lines observed in the image. 

Figure 5. Image of the crater of the moon 
The only instruction we were given was "Remove the horizontal lines in the image by filtering in the Fourier Domain" so this part of the activity is much more challenging than the rest. The first thought that entered my mind when I saw the horizontal lines in the image is the fourier transform of a number dots symmetrical at the center. 



Figure 6. Enhanced Image of the crater of the moon


Another task is to remove the noise of the following image of a house. 

Figure Subject image

In this image, no pattern can be easily observed. Thus, we have to observe its fourier transform. I created a mask by thresholding the FT of the image and converting it to binary. The result is the following image.

Resulting enhanced image
 I couldn't have done this last part without the help of Eric who guided me in performing these image enhancement. Kudos to Eric for patiently helping me! :)

I give myself a grade of 10/10 in this activity for being able to do all the assigned task.



Walang komento:

Mag-post ng isang Komento