Thursday, August 6, 2009

Act 9: Binary Operations

In this activity, we make use of the image below:

And determine the average size of the punched holes. First, we segment the image into a number of parts, which in my case was 9, and we set aside one of those images. I used the image below:

The image is used to determine the saturation level appropriate for the whole image in order to binarize the image and to be able to apply the closing operator. The closing operator works by first eroding the image, then dilating it with a structural element. The structural element I used was

which was a binarized cropped image of a punched hole from the image. This allowed the punched holes to somehow “normalize” to their proper size especially if the image does not seem to form a circle, and if possible, allow sufficiently close holes to separate themselves from each other. It was found that the image had an an average hole size of 512, and thus the code is now useable for the other cropped images. By using bwlabel to label the circles, the area of each circle in an image can be computed. The obtained values are tabulated below:

The histogram is plotted below:

The extremely large values can be attributed to the large accumulation of holes which unfortunately was not resolved by the closing operator. It is difficult to resolve overlapping holes since they sometimes do not exhibit a clear border. By limiting the allowable areas to 400 < x < 600 which is the realistic range of areas for a hole, the average was found to be 504 (503.904762).

I will give myself a grade of 9/10 for being able to completely accomplish all the tasks in this exercise. The reduced grade is for the somewhat large area values resulting from my processing, which I feel could be much better. Again, I would like to thank Earl for the discussions and Gilbert for his help in making a histogram for the areas.

Wednesday, August 5, 2009

Act 8: Morphological Operations

In this activity, we investigate the effects of the morphological operations erode and dilate when used on an image. We use the following images in particular:

We make use of the following structuring elements on all images for both dilation and erosion operation:
a) 4x4 matrix
b) 2x4 matrix
c) 4x2 matrix
d) a cross 5 pixel long and 1 pixel thick

The images from left to right displayed below will correspond to a to d.
Square
Dilation:

Erosion:



Triangle:
Dilation:

Erosion:



Circle:
Dilation:

Erosion:



Hollow Square:
Dilation:

Erosion:


Cross:
Dilation:

Erosion:


What happens during dilation is that the image expands in the form of the structural element. An example is when the square is dilated using the cross structural element, the square not only expands but its shape also becomes crosslike. Erosion works similarly to dilation, except that it shrinks the image in its form. For example, the hollow square simply becomes four small squares that are positioned in each of the original hollow square's corners.

My submitted predictions were generally correct for the dilation part. Erosion was much harder to predict for me for the triangle, hollow square and cross due to their somewhat irregular shape.

I would grade myself a 9/10 for this activity for being able to perform the operations correctly and a few correct predictions. I would like to thank Earl for his help in this activity.