In mathematical morphology, the closing of a set (binary image) A by a structuring element B is the erosion of the dilation of that set,
where and denote the dilation and erosion, respectively.
In image processing, closing is, together with opening, the basic workhorse of morphological noise removal. Opening removes small objects, while closing removes small holes.