Image Erosion

Description

This operator performs morphological erosion on the input grayscale or binary image. Erosion is a fundamental morphological operation opposite to dilation. Its core effect is to cause bright regions (such as white pixels) in the image to "shrink" or "thin". It works by sliding a structural "kernel" over the image and assigning the minimum pixel value within the area covered by the kernel to the center pixel, thereby achieving the effect of shrinking bright areas.

Overview

Shrinks bright areas in the image through morphological operations to remove noise and tighten edges.

Scenarios

  • Noise removal: Effectively removes isolated small bright spots or patches (often referred to as "salt" noise) in the image.

  • Separating objects: When two or more objects are slightly connected, the erosion operation can break the fine connections between them, thereby separating them.

  • Thinning contours: Makes the contours of objects thinner, removing burrs on the edges to make the shape smoother.

  • Combined operations: Serves as a foundational step for more complex morphological operations (such as "Opening").

Inputs and Outputs

Inputs

Image: The single-channel grayscale or binary image to be processed.

Outputs

Eroded image: The image after erosion processing.

Parameters

Erosion Kernel Size

Description

The side length of the square structuring kernel used for the erosion operation. For example, a value of 3 means a 3×3 kernel is used.

Tuning Instructions

  • Increasing this value: produces a stronger erosion effect, shrinking bright regions over a wider area, capable of removing larger noise spots or disconnecting thicker connections.

  • Decreasing this value: produces a gentler erosion effect, resulting in more subtle changes to the image.

When tuning, select an appropriate kernel size based on the size of the noise to be removed or the thickness of the connections to be severed. In general, the kernel size should be slightly larger than the feature size being processed. Odd numbers are typically used, such as 1, 3, 5, etc.

Parameter Range

[1, 50], default value: 3

Parameter Range

Values/Range: [1, 50]

Default: 3

Iterations

Description

Sets the number of times the erosion operation is applied consecutively.

Tuning Instructions

Increasing the iteration count is equivalent to repeatedly applying a kernel of the same size to the image, causing the bright regions to shrink progressively. For example, 2 iterations of a 3×3 erosion kernel produce a stronger effect than 1 iteration.

When fine-grained control over the degree of erosion is required, keep the kernel size small and gradually increase the iteration count to strengthen the effect incrementally.

Parameter Range

[1, 100], default value: 1

Parameter Range

Values/Range: [1, 100]

Default: 1