Aller au contenu

Erode Dilate Node

By Kriss Norde

Erode Dilate applies morphological operations: growing (dilation) or shrinking (erosion) the bright areas of an image. Essential for cleaning up mattes, refining a green screen, filling holes and removing stray pixels on the edges of a key.

Overview

Erode Dilate is a mathematical morphology filter. It works pixel by pixel, looking at a neighborhood around each pixel, then taking either the max (dilation = grows the bright areas) or the min (erosion = shrinks the bright areas).

On a matte (black and white), the effect is immediate: the white matte grows or contracts. It is the number 1 tool to fix a green screen key whose edges eat into the subject (the keyer eroded too aggressively) or spill over (dilation needed to win it back).

Where to find this node

  • Effects Library: Tools > Filter > Erode/Dilate
  • Quick add: right-click in the Node Editor → Add Tool > Filter > Erode/Dilate

Morphology: erosion vs dilation

Erosion (Amount < 0)
Shrinks the bright areas. Erases small white islands, thins the outline of a matte. Useful to remove the green screen fringe / halo that spills onto the subject.
Dilation (Amount > 0)
Grows the bright areas. Fills small black holes in a matte, thickens an outline. Useful to extend a matte that is too tight.

Classic technique: erosion then a light dilation of the same amount = closing (fills small holes without changing the overall size). The reverse order (dilate then erode) = opening (removes small artifacts).

Inputs

  • Input (yellow) - image to modify (typically a black and white matte).
  • Effect Mask (blue) - optional. Limits the operation to an area.

Setup

Delta Keyer → Erode Dilate → Matte Control → Merge 2D
            (Amount -0.002)  (resync alpha)

Or for an incoming matte:
Matte source → Erode Dilate → Blur → Merge

Controls tab

Amount
Amount of the operation, in units relative to the height of the image. Positive = dilation, negative = erosion. A subtle value: 0.001 (= 1 pixel on a 1080p image) is often enough to fix a key. (default: 0)
X / Y
Unlocking them lets you control the horizontal and vertical directions independently. Useful for directional artifacts (e.g. scanlines, vertical-only edges).
Red / Green / Blue / Alpha
Applies the operation per channel. Most of the time, you enable only Alpha (the matte). For a visual "corrosion" effect, apply it to RGB.

Use cases

  • Matte cleanup after keying - Delta Keyer → Erode Dilate Amount -0.001 → edge pulled in slightly, no more visible green spill around the outline.
  • Filling holes in a matte - dilation Amount +0.003 closes the small holes caused by noise in the key, then erosion -0.003 to get back to the original size (a "closing" operation).
  • Roto cleanup - after an imperfect roto, an Erode of -0.001 eats light overspill, a Dilate of +0.001 recovers missing areas as needed.
  • Custom glow / animated border - duplicate a matte, Dilate it, subtract the original = a thin border around the silhouette, useful for energy effects.
  • Corrosion / pixelation effect - an aggressive Erode (-0.01) on the alpha of a text = edges that "eat" into the image, a glitch / damaged look.
  • Softening before a Blur - a light Erode before a strong Blur keeps the subject from spilling over after the blur.

Tips

  • Units = a fraction of the image height - Amount 0.001 in 1080p = 1.08 pixels. In 4K = 2.16 pixels. So if you change format, the values stay relatively consistent.
  • Subtle first - start at ±0.0005 and go up. Too much Erode/Dilate destroys a matte (corners disappear, areas merge).
  • Combine it with Soft Edge - after Erode/Dilate, a light Blur or a Matte Control (Soft Edge) softens the edges for clean integration.
  • Only works on enabled channels - check that Alpha is ticked if it is a matte (otherwise the node apparently does "nothing").
  • For a pro green screen key: Delta Keyer → Erode Dilate (-0.001) → Matte Control (Low/High spread, Soft Edge). A classic chain that fixes 90% of edge problems.
  • An alternative to difficult roto - if a roto is close but imperfect, a fine Erode Dilate can make the difference before you redo it by hand.