Home : Image Processing : Image Clean-up/Correction Techniques : MorphoDocumentCommand Mask Property
Q10444 - INFO: MorphoDocumentCommand Mask Property

The MorphoDocumentCommand has a Mask property which has very sparse documentation:

Here is the extra info you need to know in order to make use of the mask

The Mask property contains so called “structuring element”, which is used by operations in mathematical morphology, a matrix basically.

During morphology operation, each pixel of input image is analyzed and is compared with the matrix:

        In case of dilation it is compared with origin (center of the matrix). If both are set to 1, all neighbor pixels are set to 1 according to the structuring element matrix.

        In case of erosion the pixel and its neighbor pixels are compared with the matrix and if all these pixels are set to 1 the same way as in the matrix, they are replaced with the single pixel (all neighbor pixels are set to 0).

        Opening and closing operations are set of erosion and dilation or dilation and erosion operations correspondingly, so the meaning of the matrix is the same as above.

 

So, the size of the matrix affects the size of image objects in destination image - how thin they are after erosion operation, or how thick they are after dilation.

 

The structuring element matrix should have equal odd number of rows and columns, its size depends on user needs. MorphoDocumentCommand uses 3x3 matrix by default.

 

Here is result of processing with the command and structuring element matrix where all items are set to 1:

Original image sample:

 

1         Dilation

a         Processing with matrix 3x3:
1 1 1
1 1 1
1 1 1

b        Processing with matrix 5x5:
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1

 

2         Erosion

a         Processing with matrix 3x3:
1 1 1
1 1 1
1 1 1

b        Processing with matrix 5x5:
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1

 

 

 

Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.

Powered By InstantKB.NET v1.3
Copyright © 2002, 2017. InstantASP Ltd. All Rights Reserved