Thursday, August 6, 2009

ACTIVITY 7 - Enhancement in the Frequency Domain

The goals of this activity is to be able to remove unwanted repetitive patterns by creating filter masks to block frequencies of the unwanted patterns in the Fourier domain. In doing so, the desired frequencies of the image may be enhanced thus, enhancing the quality of the image at the same time.
Activity 7.A Convolution Theorem

An binary image of an aperture consisting of two dots (one pixel each) was created using MS Paint. Its FT was taken and then displayed.

The FT modulus resulted a sine function along an axis which is symmetric about the center, which is expected. As we know, the FT of a sine function will result to two dirac deltas which will peak at the frequency of the sine function. Conversely, if we take the FT of two dirac deltas represented by two one-pixel point symmetric at the center, a sine function will be obtained with frequency related to the separation of the points.

Next, the dots were replaced with circles of some varying radius.


When the two dots were replaced with two circles with certain radius, the FT resulted into an airy disk pattern with embedded alternating parallel lines. This was due to the convolution of the circular aperture with the dirac deltas. The convolution theorem states that the FT of a convolution of two functions in space is the product of the two functions' FT. When the circular aperture and the two points were convolved, its FT came from the product of each function's FT, which is an airy disk pattern and a sine function, correspondingly. We can also observe that as the radius of the circles increases, the resulting radius of the airy disk pattern decreases.

After with circles, squares of some varying width were utilized.

Again, this is a convolution of two function, the square aperture and the two dirac deltas with FT resulting from the product of FT of each function. The FT of a square aperture is a sync function and the FT of the two dots is a sine function. The FT modulus came from the product of the two FTs. As with the varying radius of the circles, the as the width of the square increases, the width of the FT images decreases.
-------------------------------------------------------------------------------------------------
Lastly, the dots were replaced with Gaussians with the form Gaussians with varying variance (sigma squared) were created. The peak location of these Gaussians are located at ±mu.

The figures above shows the Gaussians with increasing variance (sigma squared) alongside with its FT modulus. For a better view, the images below showed it in 3D.









































We can say that this is a convolution of the Gaussian function and the two dots (dirac deltas). Taking its FT will again result to the product of the FT of each function. The Fourier Transform of a Gaussian function is also a Gaussian function and the FT of the dirac deltas is a sine function. Therefore, the resulting FT modulus is a Gaussian function with alternating parallel lines. As the variance of each Gaussians was increased, the radius of the Gaussian in the frequency domain decreases.
-------------------------------------------------------------------------------------------------
Activity 7.B Fingerprints : Ridge Enhancement
In this part of the activity, we tried to enhance an image of a fingerprint which was downloaded from the internet. The enhancement includes emphasizing the ridges of the fingerprint and removing its blotches.
The image was then opened in Scilab as grayscale image. Its FT was obtained by the procedure done in the previous activities. Then the FT was displayed in logarithmic scale in order for us to visualize where the frequencies of the fingerprint ridges lie. This will give us the idea on how to design the filter mask that will enhance the appearance of the ridges and at the same time remove the blotches.

I designed the filter mask below. The white blobs corresponds to the frequencies that will be enhanced relatively with the black areas which are frequencies that will be lowered/omitted.
The filtering was done by taking the FT of the fingerprint image and multiplying it to the filter mask image which was shifted using fftshift function. The product was then inversed and resulted to the enhanced image below.
From the enhanced image, we can see that the diagonal line is not as visible as with the original fingerprint. Although the ridges are not as sharp as with the original, we can notice that the blotches are removed.
-------------------------------------------------------------------------------------------------
Activity 7.C Lunar Landing Scanned Pictures : Line removal
This part of the activity focuses on the removal of the frequencies that produces vertical lines in the image. An image of the moon's surface from a lunar landing was utilized in this part. Parallel vertical lines are visible through out the image.
To remove these lines, we must know where the frequencies of the lines lie. We get the FT of the image and displayed it in logarithmic form. From this image, we have the idea that the frequencies correspond to the parallel lines lie in the bright region that forms the vertical line. As we know, the FT of two dots along horizontal is a sinusoidal function which corresponds to the parallel vertical lines. So in order to remove these lines, we block the bright horizontal line and have our filtering mask. We might as well block the bright vertical line so that some horizontal lines in the image may be removed. We must be careful not to block the center of the filter because there are so much information there that we needed. The image below was used as the filtering mask of the image.
As before, the enhanced image was obtained from inversed of the product of the FT of the image and the fftshift of the filter mask.
From the enhanced image above, the removal of the parallel lines is visible. The quality of the image was enhanced as well.
-------------------------------------------------------------------------------------------------
Activity 7.D Canvas Weave Modeling and Removal

The last part of the activity utilizes a canvas painting. We will use what we have learned in image enhancement to remove the canvas weave visible in the painting.
We begin our filtering by first getting the FT of the painting in logarithmic form. This shows where the frequencies of the unwanted pattern can be found. From the image below, we notice the presence of some bright spots along the center. Compared from the previous part, the location of the frequencies that correspond to the combination of parallel vertical and horizontal lines is distinct. In order to remove these frequencies, we design the filtering image by blocking these bright spots. The image below shows the filtering mask used.
The enhanced image was then obtained by from the inversed of the product of the FT of the image and fftshift of the filter mask.
Clearly from the image above, we can see the image was enhanced by the removal of the canvas weave pattern.

To show that what we have blocked using the filter mask is really the weave pattern, we tried to generate the pattern from the filter. First the filter was inverted and the inverse FT was taken. The FT modulus is closely similar to the canvas weave as shown below.

I grade myself a 10 out of 10 in finishing this activity. This activity shows me how the convolution of two functions affect their FT modulus. The FT of two convolved function will result to the superposition of the FT of each function. I was able to use this idea in removing unwanted patterns and enhancing an image. I acknowledged Gilbert who was always there discussing and working with me during class hours.

No comments:

Post a Comment