In mathematical morphology, opening is the dilation of the erosion of a set A by a structuring element B:
where and denote erosion and dilation, respectively.
Together with closing, the opening serves in computer vision and as a basic workhorse of morphological noise removal. Opening removes small objects from the foreground (usually taken as the bright pixels) of an image, placing them in the background, while closing removes small holes in the foreground, changing small islands of background into foreground. These techniques can also be used to find specific shapes in an image. Opening can be used to find things into which a specific structuring element can fit (edges, corners, ...).
One can think of B sweeping around the inside of the boundary of A, so that it does not extend beyond the boundary, and shaping the A boundary around the boundary of the element.
Opening is idempotent, that is, .
Opening is increasing, that is, if , then .
Opening is anti-extensive, i.e., .
Opening is translation invariant.
Opening and closing satisfy the duality , where denotes closing.
In morphological opening , the erosion operation removes objects that are smaller than structuring element B and the dilation operation (approximately) restores the size and shape of the remaining objects. However, restoration accuracy in the dilation operation depends highly on the type of structuring element and the shape of the restoring objects. The opening by reconstruction method is able to restore the objects more completely after erosion has been applied. It is defined as the reconstruction by geodesic dilation of erosions of by with respect to :
where denotes a marker image and is a mask image in morphological reconstruction by dilation. denotes geodesic dilation with iterations until stability, i.e., such that Since , the marker image is limited in the growth region by the mask image, so the dilation operation on the marker image will not expand beyond the mask image. As a result, the marker image is a subset of the mask image (Strictly, this holds for binary masks only.