AP 186 Activity 7: Morphological Operations

Morphology is a generic term which means structure or configuration. Classical morphological operations in image processing are applied in binary images, i.e., in images with black (0) background and white (1) foreground. Such techniques are done in order to process or extract information. Morphological operations are done by virtue of Set Theory.  Some examples of this kind of operation are dilation and erosion. 

The operator erosion reduce or cut down the set A by following the shape of set B. It is expressed as

where the set B is called the Structuring Element (SE) and the set z is formed such that the set B translated with z is a subset of set A. An illustration of the operation is shown below for better understanding.

On the other hand, the dilation of set A by set B, i.e., A dilation B, is expressed as

where the set B is called the Structuring Element (SE) and z is the set of translations such that the reflected set B intersected with set A was not a null set. Morphologically, the operator called dilation expands or streches set A by following the shape of set B. An illustration of this operation is shown below.

One important property of these two operators is

or the complement of the erosion of set A by set B is equal to the complement of set A dilation B. In this activity, the erosion and dilation of different aggregates/sets of white pixels by different sets of white pixels (SE) are demonstrated. The first thing to do was to hand-draw the sets of white pixels of interest on a sheet of graphing paper. And then the students are tasked to predict  the resulting set from the erosion and dilation of a set by another set. The sets to be eroded/dilated are the following:

  • 5×5 square
  • triangle (base = 4 boxes, height = 3 boxes)
  • 2-box thick 10×10 hollow square
  • 1-box thick plus sign, 5 boxes long

and the sets that will dilate/erode or the SEs are the following:

  • 2×2 ones
  • 2×1 ones
  • 1×2 ones
  • 1-pixel thick cross, 3 pixels long
  • diagonal, 2 boxes long ([0 1;1 0])

After drawing and predicting, the image of the sets and SEs are generated. These were then morphologically operated with dilation and erosion using the dilate and erode functions of Scilab. Finally, the hand-drawn predictions are compared with the generated images using Scilab. I have drawn the binary images in MS Paint for the second part of this activity. Moreover, 1 box is equivalent to 1 centimeter. We will later see the effect of the small SE like the 1-pixel thick and 3-pixel long cross to the shapes.

Here are my results for the 5×5 square dilated with the various SEs.

It is evident that the predicted hand-drawn configuration were similar to the generated results. However, the results for the dilation by  the cross appear to be different from the prediction here. By zooming in, the edge of the generated result is similar to the prediction. It might  be because I used an image of the small cross as the SE instead of using a matrix, [0 1 0; 1 1 1; 0 1 0].

Here are my results for the triangle dilated with the various SEs.

Here are my results for the hollow square dilated with the various SEs.

Here are my results for the plus sign dilated with the various SEs.

My hand-drawn and the Scilab-generated images appear to be similar for almost all the said sets of shapes eroded and dilated with the SEs. (Hurrah!) There are some difference in the results of the cross structuring element. I tried using the matrix form but the result is the same. 😦 In addition, I noticed that the position of the SE with respect to the center greatly affects the resulting configuration. It is because of symmetry. In general, erosion really reduced the set of white pixels and the dilation extended the white shapes.

Logic, focus and imagination is very necessary for this activity.  ^^,

I give myself a 10/10 for this activity because I did all the steps and my results agree with each other.

Reference:

1. M. Soriano, “A7 – Morphological Operations”, 2012.

Leave a comment