Thursday, August 2, 2012

Act 7: Erosion and dilation: Morphological Operations

(To follow: video tutorial of how to get the erosion/dilation of an image given a structuring element)

In this activity, we were asked to predict the dilation and erosion of the following images:
  • 5x5 square
  • 4x3 triangle
  • 10x10 hollow square; 2 pixels thick
  • 5x5 cross; 1 pixel thick
using the following structuring elements(SE):
  • 2x2 square
  • 2x1 rectangle
  • 1x2 rectangle
  • 3x3 cross
  • 2x2 (lower left to upper right) diagonal
Here are my predictions:



 

 
The predicted dilation(top) and erosion(middle) of four image(in four pages) 
with the structuring elements at the bottom row of each page.


As we can see, erode looks for the SE in the image. Dilate makes the images thicker, with the "pressure" being related to the SE. It must be noted that these processes are not inverses of each other; taking the dilation of the erosion of an image (or vice-versa) does not return the original image. In fact, that process is called opening, and the reverse is called closing.

By virtue of changing the structuring element, one can choose which characteristic one wants to highlight.

Next, we check the predictions using SciLab. Since SIP has morphological operations, getthing the dilation and erosion is easy and intuitive.
dilate(Image, SE);
erode(Image, SE);





Images(top) with various structuring elements(left) 
and the corresponding erosion(middle) and dilation(right)

Almost all of the predictions were confirmed, except for the erosion of the hollow 10x10 and 5x5 cross using the diagonal structuring element. Rechecking my work assures me that it was not simply a careless mistake. The result from the code does not seem to fit the pattern - perhaps an anomaly? It would be of interest to inspect the code for the dilate and erode commands.

 I was able to do the necessary work, so 10/10. :)

No comments:

Post a Comment