The subsequent morphological operators are defined in terms of erosion and dilation. Their expressions for gray-scale and binary images are the same and a distinction will not be henceforth made.
A is said to be opened by B if the erosion of A by B is followed by a dilation of the result by B.
equation3237
Opening results in removal of narrow peaks. The initial erosion removes the small details and darkens the image. The following dilation increases the brightness but does not reintroduce the details removed by erosion.
Similarly, A is said to be closed by B if A is first dilated by B and the result is then eroded by B. Thus,
equation3239
Closing is used to remove dark details from an image. The initial dilation removes dark details and makes the image brighter. The erosion that follows darkens the image but does not reintroduce the details removed by dilation.
Opening as well as closing are idempotent operators i.e., consecutive openings do not change an image, nor do consecutive closings: tex2html_wrap_inline6587 and tex2html_wrap_inline6589 .