Thursday, August 6, 2009

Activity 10 | Preprocessing Text

Activity 9 | Binary Operations

Monday, July 20, 2009

Activity 8 | Morphological Operations

Morphological operations simply refers to operating on the structure of something and these operations can be thought of like operations on sets like 'union', 'intersection', 'complement' and many others. An example of operations is the XOR which is union minus intersection and [NOT(A)] AND B which is the intersection of 'complement of A' and 'B'.

In this activity morphological operations like 'dilate' and 'erode' are implemented on 5 images namely a square, triangle, circle, a hollow square and a cross. Four structuring elements are used in the dilation and erosion of these images and these are a 4x4 square, 2x4 and 4x2 rectangles, and a 5x5 cross with a width=1. Figure 1 shows the structuring elements while Figure 2 shows the original image (column 1) and the respective resulting images for the dilation of the original with the order the same as the order of the structuring elements in Figure 1 while Figure 3 shows the results for erosion.


Figure 1. Structuring elements.


Figure 2. Resulting images after dilation.


Figure 2. Resulting images after erosion.


Before erosion a dilation was applied to the images by simulating the predicted resulting images. The shape of the predicted images are the same as the simulations. Only the dimensions of the resulting images were a bit different than the simulated ones but were close estimations. An simple example is for the 50x50 square when dilated with the 4x4 square. The predictions made resulted to a 54x54 square but the simulations gave a 53x53 square. This error is due to the assumption that the center and the axes used for the operations did occupy pixels.

I give myself a grade of 9 for this activity for the successful predictions of the shape of the resulting dilated and eroded imaged and for the good estimation of the dimensions.

Activity 7 | Enhancement in the Frequency Domain

The Fourier Transform properties had been familiarized already in the previous activities. With this knowledge we use it to enhance images not by changing the image itself but its Fourier Transform. Now we examine the FTs of different patterns such as two dots with increasing radius where the smallest dots are two separate pixels as shown in Figure 1.

The FT of the two pixels is a series of lines that looks like a sinusoid. We can remember from previous activities that the FT of a sinusoid are two small dots along the axis of propagation of the sinusoid. Taking the FT of the two separate pixels is like doing the inverse FT of the FT of a sinusoid. The FTs of the two small circles on the other hand is like the product of the FT of the two pixels and a circle like that from Activity 5, and it is observed that increasing the size of the spots decreases the size of the resulting FT.




Figure 1. Two dots with increasing radius and their respective FTs.

We know that a pixel is square in shape. If we enlarge these squares the FT will change from that of a sinusoid pattern to like that of the two small circles only instead of the product of the FT two dots and a circle, the patterns looks like the product of two dots and a scquare. Increasing the size of the squares also decreases the size of the FT pattern just like in Figure 1. The images for the squares and their FTs are shown in Figure 2.




Figure 2. Two squares with increasing size and their respective FTs.

Now Figure 3 shows the two gaussian of varying variance and their FT while Figure 4 shows the Gaussian dots and the inverted counterparts and the real and imaginary parts of their FTs. It may not be visible but there is a small faint set of vertical lines shaped in a circle centered at the bright spot.



Figure 3. Two Gaussians with increasing variance and their respective FTs.




Figure 4. Two Gaussians with increasing variance and their respective FTs' real (middle row) and imaginary (last row) parts.


Using the concepts above we apply them in enhancing images in the frequency domain. We perform enhancement on three images namely a fingerprint for ridge enhancement, lunar landing scanned pictures for line removal, and a digital painting for canvas weave modeling and removal.

RIDGE ENHANCEMENT - Fingerprint


Figure 5. To be enhanced fingerprint image and its FT.

Enhancing this fingerprint such that the ridges are defined is the main goal for this part of the activity. Looking at the FT of the fingerprint we can see areas that are the brightest and could possibly be the FT pattern for the ridges. Basing from the FT we then create a mask to obtain the ridges of the fingerprint alone.

Mask 1: Thresholding


LINE REMOVAL - Lunar landing scanned pictures


Figure 5. To be enhanced fingerprint image and its FT.

CANVAS WEAVE MODELING and REMOVAL - painting