Treat the image as terrain: cell centres are deep valleys, boundaries are ridges. Flood the valleys with water — the instant two separate pools would touch, build a dam there instead. That dam is the segmentation.
Flood the valleys, dam the ridges
Two rising pools meeting at a saddle point is the whole algorithm — everything else in this lab is just getting a clean landscape to flood.
Flooded basinWatershed dam / boundarySeed / marker
Ready.
Live Explanation
Loading…
Tilt angle
38°
Dark valleys = cell centres (high distance-transform). Bright ridges = boundaries. Hover any point on the 2D image above for live telemetry.
Drag the horizontal slice line on the image to cut across two touching cells.
Flood level
0%
Height profile along the slice
Blur size
2
Otsu offset
0
Distance τ
12
This scene is deliberately noisy — automatic seed detection would shatter into dozens of pieces. Paint your own markers and watch it segment cleanly anyway.
Fix strength
0
Terrain, not pixels▾
Distance transform = elevation
Every foreground pixel's value becomes "how far am I from the nearest background pixel." Cell centres score highest (deep valleys); boundaries score near zero (ridges) — a genuinely computed landscape, not an artistic metaphor.
Over- vs under-segmentation
Too many seeds (noise creates fake local maxima) shatters one real cell into many. Too few seeds (threshold too strict, or two cells share one basin) merges two real cells into one. Marker-controlled watershed exists specifically to override both failure modes by hand.
Why the metric changes basin shape
L₂, L₁, and L∞ all answer "how far to the edge" differently — L₂ measures as the crow flies (circles), L₁ measures axis-aligned steps (diamonds), L∞ measures the single worst axis (squares). Same algorithm, different geometry.
Predict, then verify
In Stress Tests, you run Noise Blast without any fix applied. Roughly what happens to the number of segmented regions compared to the clean scene?