StrataQuest Home › StrataQuest Glossary › Morphological Operations
BOM Operation

Morphological Operations

Shape processing with structuring elements

View
Definition
Mathematical morphology reshapes image structures by probing them with a small shape, the structuring elementLoading.... In StrataQuest it lives under Basic Operations Module > Morphological as separate operations: Dilate and Erode, Open and Close built from them, Top-hat, two with-black-border variants, two hole fillers, Remove small objects (from mask), and a family of Skeleton operations. Dilate, Erode, Open and Close work on masks and on grayscale images.
Dilate expands, Erode contracts
By the structuring element's radius
Scale-selective Open and Close
Open removes small objects; Close fills small holes
The kernel sets the scale
Kernel radius (px) and Kernel shape
Border handling at image edges
"With black border" variants and Border Input

How It Works

Every operation here tests how a small shape, the structuring element (StrataQuest calls it the kernel), meets the foreground. The Engines Reference gives the picture: dilation is the set of points the kernel covers as its center moves inside an object, and erosion is the set of points its center can reach while the kernel stays inside. So a 10-pixel square dilated by a disk of radius 2 becomes a 14-pixel square with rounded corners, and eroded it becomes a 6-pixel square.

Each operation is its own entry under Morphological:

OperationWhat it does
DilateInflates the shapes in the image.
ErodeDeflates the shapes in the image.
Open (erode, dilate)Erosion, then dilation with the same kernel. Removes noise and small objects from the foreground.
Close (dilate, erode)Dilation, then erosion with the same kernel. Removes noise and small holes.
Top-hatLoading...The image minus its opening, which the reference calls an estimated background. Used for feature extraction, background equalization and image enhancement.
Dilate (with black border), Erode (with black border)Add a black border to the image, then dilate or erode it.
Fill holesLoading...Fills holes in a mask: background pixels that cannot be reached by filling in the background.
Fill small holesFills only holes with fewer pixels than Area threshold (px).
Remove small objects (from mask)Removes connected objects with fewer pixels than Area threshold (px), an operation known as an area opening.
Skeleton, and the skeleton and spur operationsLoading...Reduce objects to 1-pixel-wide center lines, then find branch and end points, or extend, remove, shorten or split spurs.

In image processing generally, two more transforms are common: the morphological gradient (dilation minus erosion) and the bottom-hat (closing minus the image). The Morphological list has neither, nor a hit-or-miss transform. You can assemble the first two from Dilate, Erode, Close and Subtract images in the arithmetic operationsLoading..., because the module lets each operation use the outputs of earlier ones.

Simplified

Morphological operations reshape objects with a small template shape. Erode peels away the outer layer of objects, and Dilate adds a layer. Open (erode, then dilate) removes small specks without changing the size of larger objects, and Close (dilate, then erode) fills small holes.

Image Processing Foundation

In image processing generally, mathematical morphology was formalized by Matheron and Serra in the 1960s, and many elaborate procedures reduce to sequences of dilations and erosions. Treat the structuring element as a coin. Slide it around inside an object: everything it can cover is the opening, so spikes and threads too narrow for the coin are lost. Roll it around the outside: notches and gaps it can't enter are filled, and that is the closing.

Dilation and erosion are duals, not inverses. An object that erosion removes completely is gone, and no dilation brings it back. The Grow (global)Loading... engine has a mode built around this: Shrink (retain last pixel) keeps the last pixel of each event when the shrink size is larger than the event.

On a grayscale image the same operations act on intensity. The reference ties them to two filters: Filter max has the same effect as Dilate and Filter min the same effect as Erode, a local maximum and minimum over the kernel. That makes the Top-hatLoading... easy to read: the opening is a background estimate that can't follow bright details narrower than the kernel, so the image minus its opening keeps those details and attenuates high background.

Kernel shape matters too. In general a disk treats every direction alike, while a square reaches farther along its diagonals than along its sides, so it reshapes objects unevenly. StrataQuest's default Kernel shape is Disk; the reference names no other shape.

Simplified

Take a coin. Slide it around inside an object and anything too narrow for the coin to enter, a spike or a thin thread, is lost: that is opening. Roll it around the outside and gaps it can't get into are filled: that is closing. The coin's size determines what counts as small.

Parameters & Settings

ParameterDefaultDescription
ImageThe input image. The reference examples for Dilate, Erode, Open and Close show both a mask and a grayscale image; Fill and Skeleton operations take a mask.
Kernel radius (px)0 (Top-hat: 1)The size of the processing window: the structuring element. Dilate, Erode, Open, Close and the with-black-border variants.
Kernel shapeDiskThe shape of the kernel. Not offered by Top-hat.
Area threshold (px)0Fill small holes and Remove small objects (from mask): the largest hole or object, in pixels, to fill or remove.
Allow fill on borderNoFill holes: enables or disables filling of holes that touch the image border.
Skeleton value255Skeleton: the value that draws the skeleton, 1 or 255.

There is no operation selector: you pick the entry. Kernel radius (px) defaults to 0 for Dilate, Erode, Open and Close, so nothing happens until you set it. A rule that follows from the coin picture: choose the radius larger than the specks or holes you want gone and smaller than the narrowest part of the objects you want to keep. Results are usually judged on the maskLoading... that comes out.

Source: StrataQuest 8.1 Engines Reference, ch. 6.8 (pp. 227–283), ch. 6.3 (Filter max and Filter min pp. 101–104), ch. 6.1 (Subtract images p. 69), ch. 6 (p. 19) and ch. 24 (p. 438).

Simplified

Pick the operation you want from the Morphological list. Then set the kernel radius, which starts at 0 and does nothing until you change it. Make it bigger than the specks you want gone and smaller than the things you want to keep.

Connected Terms

Share This Term
Term Connections