Opencv image corrosion and image expansion

Time:2021-10-13

Image corrosion

1. Morphological transformation is mainly aimed at binary images

2. Two input objects

Object 1: binary image

Object 2: convolution kernel

3. The central point of convolution kernel scans the original image pixel by pixel

4. For the pixel points in the scanned original image, the value is 1 only when the element values corresponding to the convolution kernel are 1, otherwise the value is 0,

Function erode

dst = cv2.erode ( src, kernel, iterations )

Image expansion

The expansion operation is the reverse operation of the corrosion image

After the image is corroded, the noise is removed, but the image will be compressed

For the corroded image, expansion processing can remove the noise and maintain the original shape

1. Morphological transformation is mainly aimed at binary images

2. Two input objects

Object 1: binary image

Object 2: convolution kernel

The central point of convolution kernel scans the original image pixel by pixel

When one of the element values corresponding to the convolution kernel is 1, the value of the pixel in the scanned original image is 1, otherwise the value is 0

#Function dilate

This work adoptsCC agreement, reprint must indicate the author and the link to this article

Hacking