Morphology - Graphical Morphological Processing

4. Morphology: In the form of operation in a special field - Structure Element, a specific logical operation is performed in the area corresponding to the binary image at each pixel position. The arithmetic structure is the corresponding pixel of the output image. The operation effect depends on the size and content of the structure element and the nature of the logical operation. Morphology, namely mathematical morphology (Mathematical Morphology), is one of the most widely used techniques in image processing. The most essential (most discriminative) shape features of the target object, such as boundaries and connected regions. At the same time, techniques such as thinning, pixelation, and burr trimming are often used in image preprocessing and postprocessing, becoming a powerful complement to image enhancement techniques.

Dilation, erosion, opening and closing operations are the most basic transformations in mathematical morphology.

Structural element: simply defined as the structure (shape) of a pixel and an origin (aka anchor point), using morphological filtering involves applying this structuring element to each pixel of the image, when the origin of the structuring element is the same as the given pixel When aligned, its intersection with the image defines a set of pixels on which morphological operations are performed. In principle, structural elements can be of any shape, but simple shapes such as squares, circles, and diamonds are often used, with the origin at the center (for efficiency reasons). There are two images A, S. If A is the object to be processed, and S is used to process A, then S is called a structural element. The structural elements are usually some relatively small images, and the relationship between A and S is similar to the relationship between the image and the template in filtering.

The two filtering operations, erosion and dilation, also operate on the set of pixels surrounding each pixel (neighborhood), which are defined by structuring elements. When applied to a given pixel, the structuring element's anchor is aligned with that pixel's position, and all pixels it intersects are included in the current pixel set. Erosion replaces the current pixel with the smallest pixel value found in the pixel set, while dilation replaces it with the largest pixel value found in the pixel set. Of course, for binary images, each pixel can only be replaced by a white pixel or a black pixel

The main functions of erosion and expansion: ( 1) Eliminate noise (2) Segment independent image elements, connect adjacent elements in the image (3) Find the maximum or minimum value area in the image (4) Find Gradient of the image.

4.1. Dilate: Dilation is the operation of finding a local maximum. From a mathematical point of view, it is to convolve the image with the kernel, calculate the maximum value of the pixels in the area covered by the kernel B, and assign this maximum value to the element specified by the reference point. This will cause the highlighted areas in the image to grow gradually. As long as there is an element in the corresponding position of the template and the input image, the result is not 0, and the result is not 0. Add elements to the object boundary in the image. Use 3x3 structuring elements to scan each pixel in the binary image, and perform an AND operation with the structuring element and the binary image it covers. If both are 0, the value in the resulting image is 0, otherwise it is 1. Result: The foreground object in the input image is expanded by a circle.

The effect of dilation is opposite to that of erosion. Dilation can expand the boundary of the object. The specific dilation result is related to the shape of the image itself and structural elements. Dilation is often used to bridge the same object that was originally broken in the image. After binarizing the image, it is easy to make a connected object break into two parts, which will give subsequent image analysis (such as based on connectivity). The analysis of the area and the number of statistical objects> cause troubles, at this time, the broken gap can be bridged by means of expansion

4.2. Erosion (erode): Erosion and dilation are opposite operations, and corrosion is an operation to find a local minimum. The erosion operation gradually reduces the highlights in the image. The result is 0 only when the result of the sum of the elements in the corresponding position in the template and the input image is not 0. Delete some pixels of the object boundary. Use 3x3 structuring elements to scan each pixel of the binary image, and perform AND operation with the structuring element and the binary image it covers. If both are 1, the value in the resulting image is 1, otherwise it is 0. Result: the foreground object is subtracted Small circle.

With the gradual increase of the corrosion structuring elements, the objects smaller than the structuring elements disappear one after another. Since the erosion operation has the above characteristics, it can be used for filtering. By choosing structuring elements of appropriate size and shape, all noise points that do not fully contain structuring elements can be filtered out . However, the use of corrosion to filter out noise has a disadvantage, that is, while removing noise points, it also affects the shape of foreground objects in the image, but when we only care about the position or number of objects, it has little effect.

4.3. Open operation: Open operation is to corrode first and then expand. Mainly used to eliminate small objects, separate objects at thin points, and smooth the boundaries of larger objects without significantly changing their area, while suppressing bright details smaller than structuring elements.

4.4. Closing operation: It is expansion first and then erosion. It is used to fill small holes in objects, connect adjacent objects, smooth their boundaries without significantly changing their area, and suppress dark details smaller than structuring elements.

4.5. Morphological gradient: It is the subtraction of expansive soil and corrosion map. Doing this on a binarized image can make edges stand out, and morphological gradients can be used to preserve the edge contours of objects.

4.6. Top hat transformation: subtract the open operation image from the source image. Because the result of the open operation is to enlarge the cracks or local low-brightness areas. Therefore, subtracting the open image from the original image results in a rendering that highlights areas that are brighter than the areas around the outline of the original image. Top hats are generally used to correct for the effects of uneven lighting (additional: uniform lighting plays a central role in the process of extracting objects from the background).

4.7. Black hat transformation: It is to subtract the source image with the closed operation. The resulting image after the black hat operation highlights areas that are darker than the area around the outline of the original image. Black hat operations are generally used to separate patches that are darker than adjacent points.

4.8. Why open operation can remove outliers outside the target?

The isolated point outside the target is the point with the same value as the target pixel, not the background pixel, that is, 1 instead of 0 (0 means the selected hole or background pixel value).

Using erosion, the background is expanded, the isolated point is eroded, but the erosion will cause the target area to shrink by a circle, so you need to perform an expansion operation to expand the target area back to its original size. Therefore, use the open operation to remove outliers outside the target.

4.9. Why can the closed operation remove the holes in the target?

The hole in the target has a value of 1 around it, and the value of the inner hole is 0. The purpose is to remove the 0 value in the middle of the pixels that are surrounded by 1.

The closing operation first performs the expansion operation, the target area is expanded by a circle, and the 0 of the target area is removed, but the target area will also be expanded by a circle at the same time, so it is necessary to use the erosion operation to restore the target area in the image to the previous size.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325528255&siteId=291194637