What to try
- Toggle foreground cells and taps around the fixed center of the structuring element.
- Compare erosion, dilation, opening and closing; inspect both stages of the composed operations.
What to look for: Opening removes a small isolated speck; closing can fill the hole. A foreground cell is 1, the exterior is 0, and asymmetric taps are reflected for dilation.
How it works
Dilation takes a neighborhood maximum and expands bright regions; erosion takes a minimum and contracts them. Opening applies erosion then dilation, removing small bright structures. Closing reverses the order and fills small dark interruptions. Square, disc and cross neighborhoods differ in their directional behavior.
The morphological gradient subtracts erosion from dilation to emphasize boundaries. White top-hat extracts bright detail removed by opening; black top-hat extracts dark detail removed by closing. The result depends on scale: a feature can survive a small element and disappear under a larger one.
Use it in the Lab
Use morphology after thresholding to alter a mark’s silhouette, connect regions, separate thin bridges or extract small details. In the Lab, choose luminance, RGB or alpha processing according to what should count as the shape.
Limits & distinctions
Per-channel RGB morphology can create colors absent from the source. Alpha morphology changes coverage; luminance morphology changes a tonal interpretation.
Sources & references
Guide updated
