(27) Open operation, closed operation, morphological gradient, top hat, black hat

First of all, the main purpose of morphology is to obtain the topology and result information of the object. Through some operations on the object and structural elements, the more essential shape of the object can be obtained. The main applications in image processing are:

(1) Use the basic operations of morphology to observe and process the image, so as to achieve the purpose of improving the image quality

(2) Describe and define various geometric parameters and features of the image such as area, perimeter, connectivity, granularity, skeleton and directionality

1. Open operation

The opening operation is realized by first eroding the image and then expanding, and its principle expression is as follows:                                  

dst=open(src,element)=dilate(erode(src,element))

It can exclude small clump objects (assuming that the object is brighter than the background), the result of the open operation deletes the object area that cannot contain structural elements, smoothes the outline of the object, disconnects narrow connections, and removes small protruding parts, as shown below. Shown: The left image is the original image, and the right image is the result image after using the open operation conversion. It can be found that the white space at the corner of the letter disappears.

2. Close operation

Mathematically, the closing operation is the result of dilation and then erosion. Its principle expression is as follows:

dst=close(src,element)=erode(dilate(src,element))

It can exclude small black holes (black areas) and smooth the outline of objects, but unlike open operations, closing operations generally connect narrow gaps to form elongated bends and fill holes smaller than structuring elements.

3. Morphological gradient

The morphological gradient is the difference between the dilation map and the erosion map, and its operating principle is expressed as follows:

dst=morph(src,element)=dilate(src,element)-erode(src,element)

Morphological gradient operations can preserve the edge contours of objects

4. Top hat

The top hat operation is the difference between the original image and the result image of the open operation, and its principle expression is as follows:

dst=tophat(src,element)=src-open(src,element)

The result of the open operation is to enlarge the cracks or the areas of local reduced brightness, so the effect image obtained by subtracting the open operation image from the original image can highlight the area brighter than the area around the outline of the original image, and this operation is similar to the original image. The size of the selected nucleus is related. The top hat operation is often used to separate the plates that are lighter than the adjacent ones. When an image has a large background and small objects are more regular, the top hat operation can be used to extract the background.

5. Black hat

The black hat operation is the difference between the closed operation result graph and the original image, and its principle expression is as follows:

dst=blackhat(src,element)=close(src,element)-src

The resulting image after the black hat operation highlights areas that are darker than the area around the contour of the original image, which is also related to the selected kernel size. So the black hat operation is used to separate the patches that are darker than the adjacent points, and the rendering has a very perfect outline.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=324065006&siteId=291194637