🟠 Image Dilation

Function Description

This operator performs morphological dilation operations on input grayscale or binary images. Dilation is one of the basic morphological operations, whose core effect is to make bright regions (such as white pixels) in images "expand" or "grow fatter", eroding surrounding dark regions. It achieves the expansion effect of bright areas by sliding a structural "kernel" over the image and assigning the maximum pixel value within the kernel-covered area to the center pixel.

Usage Scenarios

  • Fill holes: Effectively fills small holes or black gaps inside objects.

  • Connect broken parts: Can connect lines or regions that should be connected but have minor breaks.

  • Enhance targets: Makes target contours more obvious and slightly larger in size, facilitating subsequent recognition and analysis.

  • Combined operations: Serves as a basic step for more complex morphological operations (such as "closing operation").

Input Output

Input

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

Output

Dilated image: Image after dilation processing.

Parameter Description

Dilation Kernel Size

Parameter Description

Side length of the square structural kernel used for dilation operation. For example, a value of 3 means using a 3x3 kernel.

Parameter Adjustment

  • Increase this value: Stronger dilation effect, broader expansion range of bright areas, can fill larger holes or connect wider breaks.

  • Decrease this value: Milder dilation effect, more subtle changes to the image.

When adjusting, choose appropriate kernel size based on the size of regions to be filled or connected. Generally, the kernel size should be slightly larger than the feature size to be processed. Generally use odd numbers like 1, 3, 5, etc.

Parameter Range

[1,50], default value: 3

Iteration Count

Parameter Description

Sets the number of consecutive executions of dilation operation.

Parameter Adjustment

Increasing iteration count can enhance dilation effects, similar to increasing kernel size but not exactly the same effect.

  • Increase iteration count: Equivalent to repeatedly applying the same size kernel to the image, making bright areas continuously expand. For example, 2 iterations of 3x3 dilation will produce stronger effects than 1 iteration.

  • When fine control of dilation degree is needed, you can maintain a smaller kernel size and gradually enhance effects by increasing iteration count.

Parameter Range

[1,100], default value: 1