Cv2.erode
lastmod 2026-11-10created 2022-07-123 edits
cv2.erode is an OpenCV function that performs an erosion operation on an image. Because it takes the minimum value over the area covered by the structuring element (kernel), white regions in a binary image shrink and thin lines and small noise are removed. Its main arguments are the input image, the kernel, and the number of iterations (iterations), and following it with its inverse operation, cv2.dilate, gives noise removal (opening) or hole filling (closing).