Monday, September 29, 2014

AP 186 - A8 Morphological Operations part 1

Morphology refers to shape or structure. In image processing, classical morphological operations are treatments done on binary images, particularly aggregates of 1's that form a particular shape, to improve the image for further processing or to extract information from it. All morphological operations affect the shape of the image in some way, for example, the shapes may be expanded,
thinned, internal holes could be closed, disconnected blobs can be joined. In a binary image, all pixels which are “OFF” or have value equal to zero are considered background and all pixels which are “ON” or 1 are foreground.[1]

Before we go to the morphological operations, we need to define what is dilation and erosion of sets since we will use this later.
Erosion operator is defined by the equation[1]:
And what it does is shown below[1]:


Dilation operator is defined as[1]:
And what it does is shown below[1]:




I have to predict the resulting image if the following structuring elements are used
to a) erode and b) dilate the image input that will be enumerated later. The hand-drawn predictions are shown below and the structuring elements are enumerated below.
1. 2×2 ones
2. 2×1 ones
3. 1×2 ones
4. Diagonal [0 1; 1 0]

The inputs: 
1) 5x5 square





2) Triangle, base 4 boxes, height 3 boxes


3) 10x10 Hollow square



4) Plus sign, one box thick, 5 boxes along each line


Now these images are simulated in Scilab and we will see if our predictions match the simulated images. The simulated images are very small, the largest was 14 by 14 pixels in size so the images are blurry since I resized it. The functions that I used were CreateStructureElement() to make the structuring element which was shown in the images above as B, ErodeImage() to erode the images with the structuring element, and DilateImage() to dilate the images with the structuring element.
For the 5x5 square:
For the triangle, base 4 boxes, height 3 boxes



For the 10x10 hollow square,




For the  plus sign, one box thick, 5 boxes along each line

As you can see, every one of my predictions was right and it resembles the simulated images using Scilab.



References:
[1] M. Soriano, AP 186 manual, A8 - Morphological operations, 2014.

No comments:

Post a Comment