C15 · Objects and correspondences
Masks, thresholds and morphology
A numerical rule first creates a mask. Shape operations then alter its geometry, with specific losses and limits.
Background if needed
Theory
A threshold is a decision, not a photograph property
A mask stores 0 and 1: a dark symbol below the threshold can receive 1. Otsu chooses a split that increases separation of group means relative to within-group variation. It does not know where a letter is; it sees an intensity histogram.
Uneven illumination breaks the assumption of well-separated groups. Local mean or Gaussian thresholds compare with a neighborhood; Sauvola also uses local variation. Multi-Otsu chooses several classes without guaranteeing they correspond to objects.
From intensity to foreground or background
Find a threshold for the dark rectangle. Increase illumination unevenness and compare a manual threshold with Otsu.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Inspect the selected point
What the plot shows
A global threshold can stop separating the object when dark background overlaps the brighter foreground intensities.
- Threshold
- 0.45
Parameters and details
Foreground is dark: mask = 1 when I < threshold. Otsu maximizes between-class variance over 32 bins; uneven illumination can mix classes even at the optimal global threshold.
Select an image point. Arrows move it; Home and End reach row edges. Viewing does not change the calculation.
Changing the example requires JavaScript and Canvas. Computed images remain available above.
Minimum, maximum and footprint shape
For a binary mask, erosion retains the center only if every footprint point lies in the foreground. Dilation outputs 1 if any point does. A 3×3 cross and square use different neighborhoods. Grayscale versions take intensity minima and maxima.
Opening is erosion followed by dilation: it removes details that cannot contain the footprint. Closing reverses the order and can bridge narrow gaps or fill small holes. Repeating the same mathematical opening adds no further change. A speck and a useful thin stroke may be geometrically indistinguishable.
The footprint changes the result
Try four operations with a square and a cross. Watch the speck, hole and outer boundary.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Inspect the selected point
What the plot shows
Opening removes the isolated speck. Closing may fill a small hole. The operation depends on footprint size and does not know which details matter.
Parameters and details
Place the footprint center on the speck, boundary or hole. Erosion keeps 1 only when every included neighbor is 1; dilation needs just one. Opening = erosion → dilation; closing reverses the order. Outside is 0.
Select an image point. Arrows move it; Home and End reach row edges. Viewing does not change the calculation.
Changing the example requires JavaScript and Canvas. Computed images remain available above.
Connectivity, reconstruction and skeletons
Reference and further methods
Morphological reconstruction grows a marker under a mask until stable, rather than expanding everything once. This can preserve a connected object's shape. The morphological gradient is dilation minus erosion; white/black top-hats isolate details removed by opening or closing.
Hole filling depends on foreground/background connectivity: a diagonal passage may count as open or closed. Skeletonization thins shapes under topological constraints; a distance transform measures distance from background. The medial axis relates to centers of maximal inscribed disks, not any arbitrary thin line.
Practice
Test the idea under another condition. Follow the task above the images; point inspection helps explain the result. This exploration is not scored.
Speck or hole: different operations are needed
Try closing first: what happens to the hole, and to the speck? Then choose opening. Select a changed point in each result and trace the first operation.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Inspect the selected point
What the plot shows
Closing fills the small hole; opening removes the isolated speck. Neither operation judges usefulness: footprint size and shape determine what disappears.
Parameters and details
Place the footprint center on the speck, boundary or hole. Erosion keeps 1 only when every included neighbor is 1; dilation needs just one. Opening = erosion → dilation; closing reverses the order. Outside is 0.
Select an image point. Arrows move it; Home and End reach row edges. Viewing does not change the calculation.
Changing the example requires JavaScript and Canvas. Computed images remain available above.
Games
Speck or hole: different operations are needed
Which operation produced the target? Compare the speck, hole and outer boundary, then choose the operation.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Compare your result with the reference.
Inspect the selected point
What the plot shows
Closing fills the small hole; opening removes the isolated speck. Neither operation judges usefulness: footprint size and shape determine what disappears.
Parameters and details
Place the footprint center on the speck, boundary or hole. Erosion keeps 1 only when every included neighbor is 1; dilation needs just one. Opening = erosion → dilation; closing reverses the order. Outside is 0.
Select an image point. Arrows move it; Home and End reach row edges. Viewing does not change the calculation.
Changing the example requires JavaScript and Canvas. Computed images remain available above.
Test your explanation
Question 1 of 5
Which 3×3 operation removes an isolated speck?
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Choose one answer. It is checked immediately.
Limitations and references
Limits of this example
Computed: manual/32-bin Otsu and four 3×3 min/max operations. Reconstruction, skeletons and adaptive thresholds are explained, not simulated by ordinary erosion.