Monday, July 13, 2009

Act 7: Enhancement in the Frequency Domain

In this activity, manipulating the frequency domain is used to enhance the image or mask unwanted or unneeded frequencies.

A. Convolution Theorem
We start with an image of two 1-pixel dots:



Using Fourier transform, we obtain this modulus:



Next, we use circles of various radius instead of dots.



Their corresponding FTs are shown below:



We then use two squares instead of circles:



Their corresponding FTs are shown below:



Lastly, we use pairs of Gaussians of variance 0.1, 0.2 and 0.4:



Their corresponding FTs are as follows:



B. Fingerprints: Ridge Enhancement
This time we are to enhance the quality of a fingerprint image. I make use of the image below:

I crop a portion of the image in order to better process it.

The corresponding image in Fourier space of the above image is shown below

The cover up the unwanted frequencies, we use the following mask:

After applying the mask, the image

While its contrast isn't as good as the original image, the fingermarks became much more evened out, and the blotches become less apparent and the ridges are better defined.

C. Lunar Landing Scanned Pictures: Line Removal
This time we are to remove the vertical lines in an image of a lunar landing. The image was reduced in size for faster processing.

Its FT is shown below:

We make use of this mask to hide the lines:

Using the mask, we render the image below:

It can be easily observed that the horizontal lines have been removed due to the mask removing the unwanted frequencies. Thus, we can say that the mask used was appropriate for this image.

D. Canvas Weaved Modeling and Removal
This time we make use of an image of a painting and apply the appropriate mask in order to eliminate the weaves and enhance the brushstrokes.

Its corresponding FT:

We make use of this mask to remove the weaves:

After applying the mask and ifft, the newly rendered image is shown below:

It can be seen that the weaves seem minimized and the brushstrokes are much more prominent as a result. The ifft of the mask is shown below

It can be seen that the pattern is similar to the canvas weaves, and thus, the mask is fitting for this image.

I will give myself a grade of 10/10 for accomplishing all the steps in this activity completely. I would like to thank Raffy and Earl for their help as well as their ideas regarding this activity.

Wednesday, July 8, 2009

Act 6: Properties of the 2D Fourier Transform

This activity was divided into two parts. First we were to apply FFT to different 2D patterns and then we were to apply it to various sinusoid forms.

A. Familiarization with FT of different 2D Patterns

In this part, we were to apply the 2D FT to the following patterns (square, annulus, square annulus, slit, dots, respectively):


Applying the FT to these images yields the corresponding outputs:

What happens is that the initial images act as apertures. The second set of images are the output of the apertures.

B. Anamorphic property of the Fourier Transform
This time, we are to apply FT to this image of frequency 4:

which was produced by
z = sin(2*%pi*f*X);

and its various distortions.

For the initial FT, the result was:

Varying the frequency (f = 1, 2, 3, 5, 6) results to

This time, we apply a constant bias of 1, 3, 6, and 9 to the original sinusoid by and apply FT. This results to

Next, we rotate the sinusoid by an angle of 30, 45, 60 and 90. This results to


This time we make use of combination of sinusoids in X and Y. The used combinations are as follows:
1st: z = sin(2*%pi*f*X).*sin(0.5*%pi*f*Y);
2nd: z = sin(2*%pi*f*X).*sin(2*%pi*f*Y);
3rd: z = sin(0.5*%pi*f*X).*sin(0.5*%pi*f*Y);

The output is as follows:


Finally, we add several combinations of sinusoids. The following combinations of varying frequencies were used:
1st:
z = sin(2*%pi*f*X).*sin(2*%pi*f*Y);
a = sin(2*%pi*f*(X*sin(theta)+Y*cos(theta)));
z = z+a;
2nd:
z = sin(2*%pi*f*X).*sin(2*%pi*f*Y);
a = sin(2*%pi*f*(X*sin(theta)+Y*cos(theta)));
b = sin(4*%pi*f*(X*sin(theta)+Y*cos(theta)));
z = z+a+b;
3rd:
z = sin(2*%pi*f*X).*sin(2*%pi*f*Y);
a = sin(2*%pi*f*(X*sin(theta)+Y*cos(theta)));
b = sin(4*%pi*f*(X*sin(theta)+Y*cos(theta)));
c = sin(0.5*%pi*f*(X*sin(theta)+Y*cos(theta)));
z = z+a+b+c;
4th:
z = sin(0.5*%pi*f*X).*sin(0.5*%pi*f*Y);
a = sin(2*%pi*f*(X*sin(theta)+Y*cos(theta)));
b = sin(4*%pi*f*(X*sin(theta)+Y*cos(theta)));
c = sin(0.25*%pi*f*(X*sin(theta)+Y*cos(theta)));
z = z+a+b+c;

The output should be the similar to the previous, except that there should be a corresponding rotation. The output is as follows

As shown from the above, the results are in agreement with my prediction.

I will grade myself 10/10 in this activity for completing all the steps in this activity.

I would like to thank my adjacent seatmates Earl and Rommel for their advice and assistance in this activity.