Erode and dilate are basic morphological operations, and we can compose more morphological operations based on these two operations.
First, open Operation Openning
DST = open (src, Element) = dilate (Erode (src, Element))
Open operation is to the image of the first corrosion and re-expansion, the main role is to remove the small white area.
Second, closed Operation Closing
DST = Close (src, Element) = Erode (dilate (src, Element))
Closed operation is to expand an image first and then corrode, the main role is to remove small areas of black.
Third, morphological gradient operation morphological Gradient
DST = Morphgrad (src, Element) = dilate (src, Element)-Erode (src, Element)
The morphological gradient operation, in which the swelling image is subtracted from the corroded image, the main function is to find the contour of the object.
Four, Top Hat
DST = tophat (src, Element) = Src-open (src, Element)
Not clear for the time being.
Five, Black Hat
DST = Blackhat (src, Element) = Close (src, Element)-src
Not clear for the time being.
The functions that complete these operations are defined in OPENCV:
void Morphologyex (Inputarray src, outputarray dst, int op, Inputarray kernel, point anchor=point ( -1,-1), int iterations= 1, int bordertype=border_constant, const scalar& bordervalue=morphologydefaultvalue ())
The parameter op specifies the morphological operation to be performed, Morph_open open operation, Morph_close closed operation, morph_gradient morphology gradient operation, Morph_tophat tophat operation, Morph_blackhat Blackhat operation.
OpenCV notes (ix)--More morphological transformations