Morphological Operations

EE 440 Digital Image Processing, Winter 2009

Shian-Ru “Alex” Ke

            The program supports two file types, separately ‘.bmp’ and ‘.asc’.

 

    Morphological operations: There are 5 morphological operations which are implemented in the program, including erosion, dilation, opening, closing and boundary extraction. Users     can arbitrarily choose one of the morphological operations through the five radio buttons.

 

    Structuring Element (SE):

                                i.                SE size: users can dynamically change the SE size through moving the slider.

                              ii.                SE type: there are 3 types of SE which are implemented in the program, including diamond, square and octagon. Users can dynamically change SE type through the pop-up menu.

                            iii.                User-defined SE: users can arbitrarily change the SE through pressing the mouse button. When users press the specific radio button, MorphPic will show the corresponding resultant morphological operations on the original picture.

  Parameters:

MorphPic: the morphological picture

OriginPic: the resultant picture

SE: the structuring element.

SEMaxSize: the maximal SE size

SESize: the current SE size

SEType: the current SE type. It could be ‘diamond’, ‘square’, or ‘octagon’.

hSE: the handle of the axes of SE

hOriginPic: the handle of the axes of OriginPic

hMorphPic: the handle of the axes of MorphPic

 

    1.          Erosion:

    Algorithm: , A is the original picture, B is the structural element, and  is the resultant picture of the erosion of A with B.

    In matlab, erosion can be implemented by a function, called imerode.

    ;

 

    2.          Dilation:

    Algorithm: ,  is the resultant picture of the dilation of A with B.

    In matlab, dilation can be implemented by a function, called imdilate.

    ;

 

    3.          Opening:

    Algorithm: ,  is the resultant picture of the opening of A with B. The opening is to do erosion on A by B, and then do dilation on A by B.

    In matlab codes:

    ;

    ;

 

    4.          Closing:

    Algorithm: ,  is the resultant picture of the closing of A with B. The closing is to do dilation on A by B, and then do erosion on A by B.

    In matlab codes:

    ;

    ;

 

    5.          Boundary Extraction:

    Algorithm: ,  is the resultant picture of the boundary of A. The boundary extraction is A minus the eroded picture, .

    In matlab codes:

    ;

    ;

  

    1.          Load a new picture by the menu -> File -> Load:

             

  

    2.          Choose the size of structuring element through moving the slider:

    It could be between 1 and 61.

    

 

    3.          Choose the type of the structuring elements from pop-up menu:

    It could be diamond, square, or octagon.

    

 

    4.          Select one morphological operation from the five radio buttons:

    It could be Erosion, Dilation, Opening, Closing, or Boundary Extraction

    Example 1:

    SE Size = 31; SE Type = octagon; Morphological operation = closing;

    

    Example 2:

    SE Size = 5; SE Type = diamond; Morphological operation = boundary extraction;

    

    Example 3:

    SE Size = 61; SE Type = user-defined by pressing mouse button; Morphological operation = dilation;

    

 

o     Comments:

                      For the structuring element (SE), users can dynamically change the size and the type of SE. The SE size ranges from 1 to 61. And the available SE types are ‘diamond’, ‘square’ and ‘octagon’. Additionally, users can also define the specific SE with arbitrary shapes. Users can just press mouse button in the area of the axes of SE to decide whether to select the pointed cells in the area. It is very intuitional and flexible.

 

                      For the morphological operations, the program supports five operations, including erosion, dilation, opening, closing and boundary extraction.

 

                      The program also supports two file types, namely ‘.bmp’ and ‘.asc’.

                      The program provides a flexible and friendly environment to show the resultant morphological pictures, and facilitates the choice of the structuring elements.

o     Future work:

                      The program can be extended to support more morphological operations, such as Translation, Reflection, Skeletons and Pruning.