Quasi-linear algorithms for the topological watershed

Quasi-linear algorithms for the
topological watershed
Michel Couprie
Contributors to this work
Gilles Bertrand
Michel Couprie
Laurent Najman
Prelude
Watersheds
• Powerful segmentation operator from the
field of Mathematical Morphology
• Introduced as a tool for segmenting
grayscale images by S. Beucher, H. Digabel
and C. Lantuejoul in the 70s
• Efficient algorithms based on immersion
simulation were proposed by L. Vincent, F.
Meyer, P. Soille (and others) in the 90s
Watershed transform
Flooding paradigm
Flooding paradigm
Meyer’s flooding algorithm
Label the regional minima with different colors
Repeat
Select a pixel p, not colored, not watershed,
adjacent to some colored pixels,
and having the lowest possible gray level
If p is adjacent to exactly one color then
label p with this color
If p is adjacent to more than one color then
label p as watershed
Until no such pixel exists
Flooding algorithm
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
3
3
3
5
1
30 30 30 10 15
1 15 20
1 20
1
30 20 20 20 30 15
1 15
1 20
1 20
40 40 40 40 40 20 20 20 40 40 40 40 40
1
1 10
1 10
1 10
10 10 10 10 40 20 20 20 40 10
5
5
5
5
10 40 20 40 10 10
1
5
1
5
1
5
1
1
3
5
10 15
1 20 15
1 10
1
5
1
1
0
1
0
1
1
3
5
10 15 20 15 10
5
1
0
0
1
1
3
5
10 15 20 15 10
5
1
0
0
Flooding algorithm
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
3
3
3
5
1
30 30 30 10 15
1 15 20
1 20
1
30 20 20 20 30 15
1 15
1 20
1 20
40 40 40 40 40 20 20 20 40 40 40 40 40
1
1 10
1 10
1 10
10 10 10 10 40 20 20 20 40 10
5
5
5
5
10 40 20 40 10 10
1
5
1
5
1
5
1
1
3
5
10 15
1 20 15
1 10
1
5
1
1
0
1
0
1
1
3
5
10 15 20 15 10
5
1
0
0
1
1
3
5
10 15 20 15 10
5
1
0
0
Flooding algorithm
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
3
3
3
5
1
30 30 30 10 15
1 15 20
1 20
1
30 20 20 20 30 15
1 15
1 20
1 20
40 40 40 40 40 20 20 20 40 40 40 40 40
1
1 10
1 10
1 10
10 10 10 10 40 20 20 20 40 10
5
5
5
5
10 40 20 40 10 10
1
5
1
5
1
5
1
1
3
5
10 15
1 20 15
1 10
1
5
1
1
0
1
0
1
1
3
5
10 15 20 15 10
5
1
0
0
1
1
3
5
10 15 20 15 10
5
1
0
0
Flooding algorithm
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
3
3
3
5
1
30 30 30 10 15
1 15 20
1 20
1
30 20 20 20 30 15
1 15
1 20
1 20
40 40 40 40 40 20 20 20 40 40 40 40 40
1
1 10
1 10
1 10
10 10 10 10 40 20 20 20 40 10
5
5
5
5
10 40 20 40 10 10
1
5
1
5
1
5
1
1
3
5
10 15
1 20 15
1 10
1
5
1
1
0
1
0
1
1
3
5
10 15 20 15 10
5
1
0
0
1
1
3
5
10 15 20 15 10
5
1
0
0
Flooding algorithm
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
3
3
3
5
1
30 30 30 10 15
1 15 20
1 20
1
30 20 20 20 30 15
1 15
1 20
1 20
40 40 40 40 40 20 20 20 40 40 40 40 40
1
1 10
1 10
1 10
10 10 10 10 40 20 20 20 40 10
5
5
5
5
10 40 20 40 10 10
1
5
1
5
1
5
1
1
3
5
10 15
1 20 15
1 10
1
5
1
1
0
1
0
1
1
3
5
10 15 20 15 10
5
1
0
0
1
1
3
5
10 15 20 15 10
5
1
0
0
Flooding algorithm
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
3
3
3
5
1
30 30 30 10 15
1 15 20
1 20
1
30 20 20 20 30 15
1 15
1 20
1 20
40 40 40 40 40 20 20 20 40 40 40 40 40
1
1 10
1 10
1 10
10 10 10 10 40 20 20 20 40 10
5
5
5
5
10 40 20 40 10 10
1
5
1
5
1
5
1
1
3
5
10 15
1 20 15
1 10
1
5
1
1
0
1
0
1
1
3
5
10 15 20 15 10
5
1
0
0
1
1
3
5
10 15 20 15 10
5
1
0
0
Flooding algorithm
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
3
3
3
5
1
30 30 30 10 15
1 15 20
1 20
1
30 20 20 20 30 15
1 15
1 20
1 20
40 40 40 40 40 20 20 20 40 40 40 40 40
1
1 10
1 10
1 10
10 10 10 10 40 20 20 20 40 10
5
5
5
5
10 40 20 40 10 10
1
5
1
5
1
5
1
1
3
5
10 15
1 20 15
1 10
1
5
1
1
0
1
0
1
1
3
5
10 15 20 15 10
5
1
0
0
1
1
3
5
10 15 20 15 10
5
1
0
0
Flooding algorithm
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
3
3
3
5
1
30 30 30 10 15
1 15 20
1 20
1
30 20 20 20 30 15
1 15
1 20
1 20
40 40 40 40 40 20 20 20 40 40 40 40 40
1
1 10
1 10
1 10
10 10 10 10 40 20 20 20 40 10
5
5
5
5
10 40 20 40 10 10
1
5
1
5
1
5
1
1
3
5
10 15
1 20 15
1 10
1
5
1
1
0
1
0
1
1
3
5
10 15 20 15 10
5
1
0
0
1
1
3
5
10 15 20 15 10
5
1
0
0
Flooding algorithm
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
3
3
3
5
1
30 30 30 10 15
1 15 20
1 20
1
30 20 20 20 30 15
1 15
1 20
1 20
40 40 40 40 40 20 20 20 40 40 40 40 40
1
1 10
1 10
1 10
10 10 10 10 40 20 20 20 40 10
5
5
5
5
10 40 20 40 10 10
1
5
1
5
1
5
1
1
3
5
10 15
1 20 15
1 10
1
5
1
1
0
1
0
1
1
3
5
10 15 20 15 10
5
1
0
0
1
1
3
5
10 15 20 15 10
5
1
0
0
contrast
between
is not
ThereThe
is no
descending
pathminima
from the
20spreserved
to the minimum 3
Flooding algorithm
• Efficient implementation thanks to a
priority queue (non-monotonic)
• Preserves the connectivity of the binary set
constituted by the regional minima of the
original image
• Uses the graylevels as a « heuristics » to
guide the propagation of the colors
associated to the different minima
Topological watershed
Discrete sets and
W-destructible points
Let (V,E) be a (undirected) graph and
let X be a subset of V.
Graph
Graph
Discrete sets and
W-destructible points
Let (V,E) be a (undirected) graph and
let X be a subset of V.
We say that a point x  X is W-destructible for X
if x is adjacent to exactly one connected component
of X.
M. Couprie and G. Bertrand (1997)
W-destructible point
Non W-destructible point
W-destructible point
W-destructible point
Topological watersheds
• Let X and Y be two subsets of V. We say that Y is a
W-thinning of X if Y may be obtained from X by
iteratively removing W-destructible points.
• Let X and Y be subsets of V. We say that Y is a
watershed of X if Y is a W-thinning of X and if
there is no W-destructible point for Y.
M. Couprie and G. Bertrand (1997)
W-thinning
W-thinning
W-thinning
W-thinning
W-thinning
W-thinning
Watershed
Watershed 1
Watershed 2
Discrete maps and
W-destructible points
• Let (V,E) be a connected (undirected) graph.
We denote by F (V) the family composed of all
maps from V to Z.
• Let F  F (V), we set Fk = {x  V; F(x)  k},
Fk is the cross-section of F at level k
• Let x  V and let k = F(x).
We say that x is W-destructible (for F)
if x is adjacent to exactly one connected
component of Fk
M. Couprie and G. Bertrand (1997)
W-destructible points
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
3
3
3
5
1
30 30 30 10 15
1 15 20
1 20
1
30 20 20 20 30 15
1 15
1 20
1 20
40 40 40 40 40 20 20 20 40 40 40 40 40
1
1 10
1 10
1 10
10 10 10 10 40 20 20 20 40 10
5
5
5
5
10 40 20 40 10 10
1
5
1
5
1
5
1
1
3
5
10 15
1 20 15
1 10
1
5
1
1
0
1
0
1
1
3
5
10 15 20 15 10
5
1
0
0
1
1
3
5
10 15 20 15 10
5
1
0
0
W-destructible points
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
3
3
3
5
1
30 30 30 10 15
1 15 20
1 20
1
30 20 20 20 30 15
1 15
1 20
1 20
40 40 40 40 40 20 20 20 40 40 40 40 40
1
1 10
1 10
1 10
10 10 10 10 40 20 20 20 40 10
5
5
5
5
10 40 20 40 10 10
1
5
1
5
1
5
1
1
3
5
10 15
1 20 15
1 10
1
5
1
1
0
1
0
1
1
3
5
10 15 20 15 10
5
1
0
0
1
1
3
5
10 15 20 15 10
5
1
0
0
W-destructible points
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
3
3
3
5
1
30 30 30 10 15
1 15 20
1 20
1
30 20 20 20 30 15
1 15
1 20
1 20
40 40 40 40 40 20 20 20 40 40 40 40 40
1
1 10
1 10
1 10
10 10 10 10 40 20 20 20 40 10
5
5
5
5
10 40 20 40 10 10
1
5
1
5
1
5
1
1
3
5
10 15
1 20 15
1 10
1
5
1
1
0
1
0
1
1
3
5
10 15 20 15 10
5
1
0
0
1
1
3
5
10 15 20 15 10
5
1
0
0
F1
W-destructible points
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
3
3
3
5
1
30 30 30 10 15
1 15 20
1 20
1
30 20 20 20 30 15
1 15
1 20
1 20
40 40 40 40 40 20 20 20 40 40 40 40 40
1
1 10
1 10
1 10
10 10 10 10 40 20 20 20 40 10
5
5
5
5
10 40 20 40 10 10
1
5
1
5
1
5
1
1
3
5
10 15
1 20 15
1 10
1
5
1
0
1
0
1
0
1
1
3
5
10 15 20 15 10
5
1
0
0
1
1
3
5
10 15 20 15 10
5
1
0
0
Topological watershed
• Let F and G be in F (V).
• We say that G is a W-thinning of F
if G may be obtained from F by iteratively
lowering W-destructible points (by 1).
• If G is a W-thinning of F which has been
obtained by lowering a single point p (by 1 or by
more than 1) we say that p has been W-lowered.
• We say that G is a (topological) watershed of F
if G is a W-thinning of F and
if there is no W-destructible point for G.
M. Couprie and G. Bertrand (1997)
Topological watershed
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
3
3
3
5
1
30 30 30 10 15
1 15 20
1 20
1
30 20 20 20 30 15
1 15
1 20
1 20
40 40 40 40 40 20 20 20 40 40 40 40 40
1
1 10
1 10
1 10
10 10 10 10 40 20 20 20 40 10
5
5
5
5
10 40 20 40 10 10
1
5
1
5
1
5
1
1
3
5
10 15
1 20 15
1 10
1
5
1
0
1
0
1
0
1
1
3
5
10 15 20 15 10
5
1
0
0
1
1
3
5
10 15 20 15 10
5
1
0
0
Topological watershed
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
1
3
3
1
3
3
3
3
3
3
1
3
1
3
1
3
1
3
30 30 30
30 20 20 20 30
40 40 40 40 40 20 20 20 40 40 40 40 40
1
0
1
0
1
0
0
1
0
0
1
0
1
0
1
0
1
0
0
1
0
1
0
1
0
1
0
20
0
0
0
0
0
0
20
0
0
0
0
0
0
1
1
1
1
40 20 20 20 40
1
1
1
1
1
1
1
1
1
1
1
20
1
1
1
1
1
1
1
1
1
1
1
1
40 20 40
Topological watershed
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
1
3
3
1
3
3
3
3
3
3
1
3
1
3
1
3
1
3
30 30 30
30 20 20 20 30
40 40 40 40 40 20 20 20 40 40 40 40 40
1
0
1
0
1
0
0
1
0
0
1
0
1
0
1
0
1
0
0
1
0
1
0
1
0
1
0
20
0
0
0
0
0
0
20
0
0
0
0
0
0
1
1
1
1
40 20 20 20 40
1
1
1
1
1
1
1
1
1
1
1
20
1
1
1
1
1
1
1
1
1
1
1
1
40 20 40
Topological watershed
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
1
3
3
1
3
3
3
3
3
3
1
3
1
3
1
3
1
3
30 30 30
30 20 20 20 30
40 40 40 40 40 20 20 20 40 40 40 40 40
1
0
1
0
1
0
0
1
0
0
1
0
1
0
1
0
1
0
0
1
0
1
0
1
0
1
0
20
0
0
0
0
0
0
20
0
0
0
0
0
0
1
1
1
1
40 20 20 20 40
1
1
1
1
1
1
1
1
1
1
1
20
1
1
1
1
1
1
1
1
1
1
1
1
40 20 40
F40
Topological watershed
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
1
3
3
1
3
3
3
3
3
3
1
3
1
3
1
3
1
3
30 30 30
30 20 20 20 30
40 40 40 40 40 20 20 20 40 40 30 40 40
1
0
1
0
1
0
0
1
0
0
1
0
1
0
1
0
1
0
0
1
0
1
0
1
0
1
0
20
0
0
0
0
0
0
20
0
0
0
0
0
0
1
1
1
1
40 20 20 20 40
1
1
1
1
1
1
1
1
1
1
1
20
1
1
1
1
1
1
1
1
1
1
1
1
40 20 40
Topological watershed
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
1
3
3
1
3
3
3
3
3
3
1
3
1
3
1
3
1
3
30 30 30
30 20 20 20 30
40 40 40 40 40 20 20 20 40 40 30 40 40
1
0
1
0
1
0
0
1
0
0
1
0
1
0
1
0
1
0
0
1
0
1
0
1
0
1
0
20
0
0
0
0
0
0
20
0
0
0
0
0
0
1
1
1
1
40 20 20 20 40
1
1
1
1
1
1
1
1
1
1
1
20
1
1
1
1
1
1
1
1
1
1
1
1
40 20 40
F30
Topological watershed
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
1
3
3
1
3
3
3
3
3
3
1
3
1
3
1
3
1
3
30 30 30
30 20 20 20 30
40 40 40 40 40 20 20 20 40 40 30 40 40
1
0
1
0
1
0
0
1
0
0
1
0
1
0
1
0
1
0
0
1
0
1
0
1
0
1
0
20
0
0
0
0
0
0
20
0
0
0
0
0
0
1
1
1
1
40 20 20 20 40
1
1
1
1
1
1
1
1
1
1
1
20
1
1
1
1
1
1
1
1
1
1
1
1
40 20 40
Topological watershed
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
1
3
3
1
3
3
3
3
3
3
1
3
1
3
1
3
1
3
30 30 30
30 20 20 20 30
40 40 40 40 40 20 20 20 40 40 30 40 40
1
0
1
0
1
0
0
1
0
0
1
0
1
0
1
0
0
1
0
1
0
1
0
1
0
1
0
20
0
0
0
0
0
0
20
0
0
0
0
0
0
1
1
1
1
40 20 20 20 40
1
1
1
1
1
1
1
1
1
1
1
20
1
1
1
1
1
1
1
1
1
1
1
1
40 20 40
F20
Topological watershed
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
1
3
3
1
3
3
3
3
3
3
1
3
1
3
1
3
1
3
30 30 30
30 20 20 20 30
40 40 40 40 40 20 20 20 40 40 30 40 40
1
0
1
0
1
0
0
1
0
0
1
0
1
0
1
0
1
0
0
1
0
1
0
1
0
1
0
20
0
0
0
0
0
0
20
0
0
0
0
0
0
1
1
1
1
40 20 20 20 40
1
1
1
1
1
1
1
1
1
1
1
20
1
1
1
1
1
1
1
1
1
1
1
1
40 20 40
Topological watershed
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
1
3
3
1
3
3
3
3
3
3
1
3
1
3
1
3
1
3
30 30 30
30 20 20 20 30
40 40 40 40 40 20 20 20 40 40 30 40 40
1
0
1
0
1
0
0
1
0
0
1
0
1
0
1
0
0
1
0
1
0
1
0
1
0
1
0
20
0
0
0
0
0
0
20
0
0
0
0
0
0
1
1
1
1
40 20 20 20 40
1
1
1
1
1
1
1
1
1
1
1
20
1
1
1
1
1
1
1
1
1
1
1
1
40 20 40
F30
Topological watershed
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
1
3
3
1
3
3
3
3
3
3
1
3
1
3
1
3
1
3
30 30 30
30 20 20 20 30
40 40 40 40 40 20 20 20 40 40 30 40 40
1
0
1
0
1
0
0
1
0
0
1
0
1
0
1
0
1
0
0
1
0
1
0
1
0
1
0
20
0
0
0
0
0
0
20
0
0
0
0
0
0
1
1
1
1
40 20 20 20 40
1
1
1
1
1
1
1
1
1
1
1
20
1
1
1
1
1
1
1
1
1
1
1
1
40 20 40
Topological watershed
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
1
3
3
1
3
3
3
3
3
3
1
3
1
3
1
3
1
3
30 30 30
30 20 20 20 30
40 40 40 40 40 20 20 20 40 40 40 40 40
1
0
1
0
1
0
0
1
0
0
1
0
1
0
1
0
1
0
0
1
0
1
0
1
0
1
0
20
0
0
0
0
0
0
20
0
0
0
0
0
0
1
1
1
1
40 20 20 20 40
1
1
1
1
1
1
1
1
1
1
1
20
1
1
1
1
1
1
1
1
1
1
1
1
40 20 40
F40
Topological watershed
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
1
3
3
1
3
3
3
3
3
3
1
3
1
3
1
3
1
3
30 30 30
30 20 20 20 30
40 40 40 40 40 20 20 20 40 40 40 40 40
1
0
1
0
1
0
0
1
0
0
1
0
1
0
1
0
1
0
0
1
0
1
0
1
0
1
0
20
0
0
0
0
0
0
20
0
0
0
0
0
0
1
1
1
1
30 20 20 20 30
1
1
1
1
1
1
1
1
1
1
1
20
1
1
1
1
1
1
1
1
1
1
1
1
30 20 30
F30
Topological watershed
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
1
3
3
1
3
3
3
3
3
3
1
3
1
3
1
3
1
3
30 30 30
30 20 20 20 30
40 40 40 40 40 20 20 20 40 40 40 40 40
1
0
1
0
1
0
0
1
0
0
1
0
1
0
1
0
1
0
0
1
0
1
0
1
0
1
0
20
0
0
0
0
0
0
20
0
0
0
0
0
0
1
1
1
1
20 20 20 20 20
1
1
1
1
1
1
1
1
1
1
1
20
1
1
1
1
1
1
1
1
1
1
1
1
20 20 20
F20
Topological watershed
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
1
3
3
1
3
3
3
3
3
3
1
3
1
3
1
3
1
3
30 30 30
30 20 20 20 30
40 40 40 40 40 20 20 20 40 40 30 40 40
0
1
0
1
0
1
0
0
1
0
0
0
1
0
1
0
1
0
20
1
0
0
1
0
1
0
1
0
1
0
1
20
0
0
0
0
0
0
1
20
0
0
0
0
0
0
1
1
1
1
1
20 20 20
1
1
1
1
1
1
20
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
Topological watershed
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
1
3
3
1
3
3
3
3
3
3
1
3
1
3
1
3
1
3
30 30 30
30 20 20 20 30
40 40 40 40 40 20 20 20 40 40 30 40 40
0
1
0
1
0
1
0
0
1
0
0
0
1
0
1
0
1
0
20
1
0
0
1
0
1
0
1
0
1
0
1
20
0
0
0
0
0
0
1
20
0
0
0
0
0
0
1
1
1
1
1
20 20 20
1
1
1
1
1
1
20
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
Topological watershed
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
1
3
3
1
3
3
3
3
3
3
30
1
20
0
30
1
3
1
3
1
3
1
3
1
1
20
0
0
30 30 30 30
30 30 30
30 30 30 30
1
1
1
1
1
1
20
0
0
1
0
1
0
1
0
0
1
1
1
1
1
1
1
20
0
0
0
1
0
1
0
1
0
1
1
1
1
1
1
20
1
0
0
1
0
1
0
1
0
1
0
1
1
1
1
1
1
20
0
0
0
0
0
0
1
1
1
1
1
1
20
0
0
0
0
0
0
Topological watershed
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
3
3
3
1
3
1
3
1
3
1
3
3
3
3
3
3
3
1
3
3
1
3
3
3
3
3
3
30
1
20
0
30
1
3
1
3
1
3
1
3
1
1
20
0
0
30 30 30 30
30 30 30
30 30 30 30
1
1
1
1
1
1
20
0
0
1
0
1
0
1
0
0
1
1
1
1
1
1
1
20
0
0
0
1
0
1
0
1
0
1
1
1
1
1
1
20
1
0
0
1
0
1
0
1
0
1
0
1
1
1
1
1
1
20
0
0
0
0
0
0
1
1
1
1
1
1
20
0
0
0
0
0
0
The watershed
The contrast
is located
between
on the crest
minima
linesisofpreserved
the original image
W-thinning paradigm
Algorithms
Naive watershed algorithm
Repeat
For each point p in V
If p is W-destructible
F(p) = F(p)-1
Until stability
n
n2
g.n2
How can we reduce the
complexity ?
Two fundamental ideas:
1/ Find a characterization of W-destructible
points which can be checked in constant
time
2/ Find strategies which guarantee that each
point is examined at most once
Different types of points (1)
0
9
0
0
0
8
8
2
2
2
5
3
3
0
9
6
5
8
8
8
8
2
7
7
7
3
0
9
1
1
8
9
8
8
2
7
7
3
3
0
9
9
7
8
8
8
8
2
7
7
7
3
0
9
0
0
0
8
8
5
2
7
7
5
3
0
9
9
0
0
8
8
5
2
7
7
5
3
Separating point (crest)
A point p is separating for F if it is adjacent to at least two
connected components of Fk, with k = F(p)
Different types of points (2)
0
9
0
0
0
8
8
2
2
2
5
3
3
0
9
6
5
8
8
8
8
2
7
7
7
3
0
9
1
1
8
9
8
8
2
7
7
3
3
0
9
9
7
8
8
8
8
2
7
7
7
3
0
9
0
0
0
8
8
5
2
7
7
5
3
0
9
9
0
0
8
8
5
2
7
7
5
3
Inner point, minimal (flat)
A point p is an inner point for F if it is not adjacent to any
connected component of Fk , with k = F(p)
A point p is a minimal point for F if it belongs to a
regional minimum of F
Different types of points (3)
0
9
0
0
0
8
8
2
2
2
5
3
3
0
9
6
5
8
8
8
8
2
7
7
7
3
0
9
1
1
8
9
8
8
2
7
7
3
3
0
9
9
7
8
8
8
8
2
7
7
7
3
0
9
0
0
0
8
8
5
2
7
7
5
3
0
9
9
0
0
8
8
5
2
7
7
5
3
Inner point, non minimal (flat)
A point p is an inner point for F if it is not adjacent to any
connected component of Fk , with k = F(p)
A point p is a minimal point for F if it belongs to a
regional minimum of F
Different types of points (4)
0
9
0
0
0
8
8
2
2
2
5
3
3
0
9
6
5
8
8
8
8
2
7
7
7
3
0
9
1
1
8
9
8
8
2
7
7
3
3
0
9
9
7
8
8
8
8
2
7
7
7
3
0
9
0
0
0
8
8
5
2
7
7
5
3
0
9
9
0
0
8
8
5
2
7
7
5
3
Pre-separating point (crest)
A point p is pre-separating for F if it is W-destructible and
if there is a value v such that W-lowering p until v makes
p be a separating point
Different types of points (5)
0
9
0
0
0
8
8
2
2
2
5
3
3
0
9
6
5
8
8
8
8
2
7
7
7
3
0
9
1
1
8
9
8
8
2
7
7
3
3
0
9
9
7
8
8
8
8
2
7
7
7
3
0
9
0
0
0
8
8
5
2
7
7
5
3
0
9
9
0
0
8
8
5
2
7
7
5
3
Pre-inner point, M-destructible (flat)
A point p is pre-inner for F if it is W-destructible and
if there is a value v such that W-lowering p until v makes
p be an inner point
A point p is M-destructible for F if it is pre-inner and
it may become a minimal point after W-lowering
Different types of points (6)
0
9
0
0
0
8
8
2
2
2
5
3
3
0
9
6
5
8
8
8
8
2
7
7
7
3
0
9
1
1
8
9
8
8
2
7
7
3
3
0
9
9
7
8
8
8
8
2
7
7
7
3
0
9
0
0
0
8
8
5
2
7
7
5
3
0
9
9
0
0
8
8
5
2
7
7
5
3
Pre-inner point, non M-destructible (flat)
A point p is pre-inner for F if it is W-destructible and
if there is a value v such that W-lowering p until v makes
p be an inner point
A point p is M-destructible for F if it is pre-inner and
it may become a minimal point after W-lowering
Classification of points
point
crest
flat
W-destructible
separating
pre-separating
pre-inner
inner
M-destructible non-M-destructible minimal non-minimal
pre-inner
inner
Transitions (1)
0
9
0
0
0
8
8
2
2
2
5
3
3
0
9
6
5
5
8
8
8
8
2
7
7
7
3
0
9
1
1
8
9
8
8
2
7
7
3
3
0
9
9
7
8
8
8
8
2
7
7
7
3
0
9
0
0
0
8
8
5
2
7
7
5
3
0
9
9
0
0
8
8
5
2
7
7
5
3
pre-separating
separating
Transitions (2)
0
9
0
0
0
8
8
2
2
2
5
3
3
0
9
6
5
8
8
8
8
2
7
7
7
3
0
9
1
1
8
9
8
8
2
7
7
3
3
0
9
9
7
8
8
8
8
2
7
7
7
3
0
9
0
0
0
8
0
8
5
2
7
7
5
3
0
9
9
0
0
8
8
5
2
7
7
5
3
pre-inner, M-destructible
inner, minimal
Transitions (3)
0
9
0
0
0
8
8
2
2
2
5
3
3
0
9
6
5
8
8
8
8
2
7
7
7
3
0
9
1
1
8
9
8
8
8
2
7
7
3
3
0
9
9
7
8
8
8
8
2
7
7
7
3
0
9
0
0
0
8
8
5
2
7
7
5
3
0
9
9
0
0
8
8
5
2
7
7
5
3
pre-inner, non M-destructible
inner, non minimal
Transitions (4)
0
9
0
0
0
8
8
2
2
2
5
3
3
0
9
6
5
8
8
8
8
2
7
7
7
3
0
9
1
1
8
9
8
8
2
7
7
3
3
0
9
0
9
7
8
8
8
8
2
7
7
7
3
0
9
0
0
0
8
8
5
2
7
7
5
3
0
9
9
0
0
8
8
5
2
7
7
5
3
pre-separating
separating
Transitions (5)
0
9
0
0
0
8
8
2
2
2
5
3
3
0
9
6
5
8
8
8
8
2
7
7
7
3
0
9
1
1
8
9
8
8
2
7
2
7
3
3
0
9
9
7
8
8
8
8
2
7
7
7
3
0
9
0
0
0
8
8
5
2
7
7
5
3
0
9
9
0
0
8
8
5
2
7
7
5
3
pre-inner, M-destructible
pre-separating
Transitions (6)
0
9
0
0
0
8
0
8
2
2
2
5
3
3
0
9
6
5
8
8
8
8
2
7
7
7
3
0
9
1
1
8
9
8
8
2
7
7
3
3
0
9
9
7
8
8
8
8
2
7
7
7
3
0
9
0
0
0
8
8
5
2
7
7
5
3
0
9
9
0
0
8
8
5
2
7
7
5
3
pre-inner, M-destructible
separating
Transitions (7)
0
9
0
0
0
8
8
2
2
2
5
3
3
0
9
6
5
8
8
8
8
2
7
7
7
3
0
9
1
1
8
1
9
8
8
2
7
7
3
3
0
9
9
7
8
8
8
8
2
7
7
7
3
0
9
0
0
0
8
8
5
2
7
7
5
3
0
9
9
0
0
8
8
5
2
7
7
5
3
pre-inner, non M-destructible
pre-inner, M-destructible
Transitions (8)
0
9
0
0
0
8
8
2
2
2
5
3
3
0
9
6
5
8
8
8
8
2
7
7
7
3
0
9
1
1
8
9
8
8
2
7
7
3
3
0
9
9
7
8
8
8
8
2
7
7
7
3
0
9
0
0
0
8
8
5
2
7
2
7
5
3
0
9
9
0
0
8
8
5
2
7
7
5
3
pre-inner, non M-destructible
pre-separating
Transitions (9)
0
9
0
0
0
8
8
2
2
2
5
3
3
0
9
6
5
8
8
8
8
2
7
7
7
3
0
9
1
1
8
9
8
8
2
7
7
3
3
0
9
9
7
8
8
8
8
2
7
7
7
3
0
9
0
0
0
8
8
5
2
7
7
5
3
0
9
9
0
0
8
0
8
5
2
7
7
5
3
pre-inner, non M-destructible
separating
Transitions (10)
0
9
0
0
0
8
8
2
2
2
5
3
3
0
9
6
5
8
8
8
8
2
7
7
7
3
0
9
1
1
8
9
8
8
7
2
7
7
3
3
0
9
9
7
8
8
8
8
2
7
7
7
3
0
9
0
0
0
8
8
5
2
7
7
5
3
0
9
9
0
0
8
8
5
2
7
7
5
3
inner, non minimal
pre-inner, non M-destructible
Transitions (11)
0
9
0
0
0
8
8
2
2
2
5
3
3
0
9
6
5
8
8
8
8
2
7
7
7
3
0
9
1
1
8
9
8
8
2
2
7
7
3
3
0
9
9
7
8
8
8
8
2
7
7
7
3
0
9
0
0
0
8
8
5
2
7
7
5
3
0
9
9
0
0
8
8
5
2
7
7
5
3
inner, non minimal
pre-inner, M-destructible
Classification of transitions
Theorem: the only possible transitions for a point
during a W-thinning are the 11 following ones:
crest
separating
pre-inner, non M-destructible
inner, non minimal
pre-separating
pre-inner, M-destructible
inner, minimal
Pass value
• Let F be in F (V). If п is a path, we set
F(п) = Max{F(x); x  п}.
• Let x, y in V.
We set F(x,y) = Min {F(п); п  п(x,y)},
F(x,y) is the pass value between x and y.
• Let X and Y be two subsets of V. We set
F(X,Y) = Min{F(x,y); x  X and y  Y}.
Pass value
F(x,y) = 20
40 40 40 40 40 40 40 40 40 40 40 40 40
40
1
1
2
3
10
5
25
5
4
4
4
40
40
1
0
2
8
6
5
5
20
3
2
3
40
40
3
3
2
3
10
6
6
6
22
2
3
40
40
6
6
40
6
11 11 11 25
4
4
4
40
x
y
40 40 35 10 30 15 15 15 35 31 36 10 40
40 10
8
5
40
5
1
8
5
8
40 10
10 32 33 34 10 10 15 38 40
1
15 40 10
6
3
15 20 40
10 15 35 15
6
6
15 35 40
40 40 40 40 40 40 40 40 40 40 40 40 40
Separation
• Let F be in F (V) and let x and y be in V.
We say that x and y are separated (for F)
if F(x,y) > Max{F(x),F(y)}.
We say that x and y are k-separated (for F)
if x and y are separated and F(x,y) = k.
• Let F and G be in F (V) such that G  F.
We say that G is a separation of F if,
for all x,y in V, if x and y are k-separated for F,
then x and y are k-separated for G.
k-separation
x and y are 20-separated
40 40 40 40 40 40 40 40 40 40 40 40 40
40
1
1
2
3
10
5
25
5
4
4
4
40
40
1
0
2
8
6
5
5
20
3
2
3
40
40
3
3
2
3
10
6
6
6
22
2
3
40
40
6
6
40
6
11 11 11 25
4
4
4
40
x
y
40 40 35 10 30 15 15 15 35 31 36 10 40
40 10
8
5
40
5
1
8
5
8
40 10
10 32 33 34 10 10 15 38 40
1
15 40 10
6
3
15 20 40
10 15 35 15
6
6
15 35 40
40 40 40 40 40 40 40 40 40 40 40 40 40
k-separation
F(x,y) = 35 = F(y)
x and y are NOT separated (they are linked)
40 40 40 40 40 40 40 40 40 40 40 40 40
40
1
1
2
3
10
5
25
5
4
4
4
40
40
1
0
2
8
6
5
5
20
3
2
3
40
40
3
3
2
3
10
6
6
6
22
2
3
40
40
6
6
40
6
11 11 11 25
4
4
4
40
x
40 40 35 10 30 15 15 15 35 31 36 10 40
40 10
8
5
40
5
1
8
5
8
40 10
10 32 33 34 10 10 15 38 40
1
15 40 10
6
3
15 20 40
10 15 35 15
6
6
15 35 40
y
40 40 40 40 40 40 40 40 40 40 40 40 40
Theorem
(strong separation)
Let F and G be in F (V) such that G  F.
The map G is a strong separation of F
if and only if G is a W-thinning of F.
G. Bertrand (2003)
Property
(characterization of W-destructible points)
Let F be in F (V), let p be in V.
We denote by N-(p) the set of points adjacent
to p and with a strictly lower altitude
(lower neighbours).
The point p is W-destructible for F
if and only if N-(p) is not empty and
for all x,y in N-(p), we have F(x,y) < F(p).
Illustration
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
3
3
3
5
1
30 30 30 10 15
1 15 20
1 20
1
30 20 20 20 30 15
1 15
1 20
1 20
40 40 40 40 40 20 20 20 40 40 40 40 40
1
1 10
1 10
1 10
10 10 10 10 40 20 20 20 40 10
5
5
5
5
10 40 20 40 10 10
1
5
1
5
1
5
1
1
3
5
10 15 20 15 10
1
5
1
1
0
1
0
1
1
3
5
10 15 20 15 10
5
1
0
0
1
1
3
5
10 15 20 15 10
5
1
0
0
x
y
F(x,y) = 20
Illustration
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
3
3
3
5
1
30 30 30 10 15
1 15 20
1 20
1
30 20 20 20 30 15
1 15
1 20
1 20
40 40 40 40 40 20 20 20 40 40 40 40 40
1
1 10
1 10
1 10
10 10 10 10 40 20 20 20 40 10
5
5
5
5
10 40 20 40 10 10
1
5
1
5
1
5
1
1
3
5
10 15
1 20 15
1 10
1
5
1
1
0
1
0
1
1
3
5
10 15 20 15 10
5
1
0
0
1
1
3
5
10 15 20 15 10
5
1
0
0
F(x,y) = 20
Illustration
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
5
1
10 10 10 10
1 15
1 20
1 20
3
3
3
5
5
3
3
3
5
1
30 30 30 10 15
1 15 20
1 20
1
30 20 20 20 30 15
1 15
1 20
1 20
40 40 40 40 40 20 20 20 40 40 40 40 40
1
1 10
1 10
1 10
10 10 10 10 40 20 20 20 40 10
5
5
5
5
10 40 20 40 10 10
1
5
1
5
1
5
1
1
3
5
10 15
1 20 15
1 10
1
5
1
1
0
1
0
1
1
3
5
10 15 20 15 10
5
1
0
0
1
1
3
5
10 15 20 15 10
5
1
0
0
F(x,y) = 10
W-destructible point
• Definition: involves all the connected
components of a lower cross-section
• Chacterization: involves all the paths
between the lower neighbors of the point
What have we gained ?
Cross-sections, components
k
Fk = {x E, F(x) < k}
Component tree
Components + inclusion relation  tree structure
Component mapping

Illustration
F

1
1
1
1
3
0
0
0
0
0
0
0
3
2
3
0
0
0
0
0
3
2
2
2
3
0
0
0
3
1
3
2
3
1
3
0
0
0
3
0
2
0
2
0
0
0
0
0
0
2
0
0
0
0
c
c
c
c
i
b
b
b
b
a
a
a
i
g
i
b
b
b
a
a
i
g
g
g
i
b
b
a
i
f
i
g
i
e
i
b
a
a
i
a
g
b
g
b
b
a
a
a
a
g
b
b
b
b
T
4,i
3,g
2,c
2,d
1,a
1,b
3,h
2,e
2,f
Property
For any weighted graph F, the component tree of F
and the component mapping of F can be computed
in quasi-linear time, more precisely, in O(n  e(n))
where n = |V| and e(n) is a function which grows
extremely slowly with n.
This result can be obtained thanks to the Tarjan’s
Union-Find algorithm for the merging of disjoint
sets.
Tarjan, 1984
Najman and Couprie, 2004
Least common ancestor
lca(A,B)
A
B
(proper lca: different from both A and B)
Least common ancestor
E
lca(E,F)
F
(not a proper lca)
Property
Any tree T can be represented in such a way
that for any two nodes A, B of T, it is
possible to find the least common ancestor
of A and B in constant time (with a linear
time pre-processing).
Harel and Tarjan, 1984
Bender and Farach-Colton, 2000
Least common ancestor
1
1
2
3
15 33
32
2
3
11
10
12
14
16
9
5
17
13
4
6
18
8
22 24
25 31
26
28 30
4
5
6
7
19
20
21
23
27
29
Highest fork
Let T be a tree, let S be a set of n nodes of T.
For any pair (A,B) of nodes in S, take the
proper least common ancestor of A and B
if it exists.
The highest one among these ancestors (if it
exists) is called the highest fork of S.
Highest fork
D
hfork(A,B,C,D)
A
B
C
Highest fork
D
A
B
No highest fork for (A,B,D)
Property
Let T be a tree, let S be a set of n nodes of T.
The highest fork of the nodes in S (or an
indicator saying that no highest fork exists)
can be computed by n -1 binary least
common ancestor queries.
Property
Let F be in F (V), let p,q be in V.
Let T be the component tree of F and
let  be the component mapping of F.
The points p,q are k-separated if and only if
the nodes (p) and (q) have a highest fork
H in T, and if H has the level k+1.
The points p,q are linked if and only if
the nodes (p) and (q) have no highest fork
in T.
Corollary
(characterization of W-destructible points)
Let F be in F (V), let p be in V.
Let T be the component tree of F and
let  be the component mapping of F.
Thanks to T and , it is possible to check
whether p is W-destructible or not in
constant time.
It is also possible to know in constant time the
type of p and the lowest value v such that p
can be W-lowered down to v.
Illustration 1
F

1
1
1
1
3
0
0
0
0
0
0
0
3
2
3
0
0
0
0
0
3
2
2
2
3
0
0
0
3
1
3
2
3
1
3
0
0
0
3
0
2
0
2
0
0
0
0
0
0
2
0
0
0
0
c
c
c
c
i
b
b
b
b
a
a
a
i
g
i
b
b
b
a
a
i
g
g
g
i
b
b
a
i
f
i
g
i
e
i
b
a
a
i
a
g
b
g
b
b
a
a
a
a
g
b
b
b
b
T
4,i
3,g
2,c
2,d
1,a
1,b
3,h
2,e
2,f
Highest fork = 3,g
Not W-destructible
Illustration 2
F

1
1
1
1
3
0
0
0
0
0
0
0
3
2
3
0
0
0
0
0
3
2
2
2
3
0
0
0
3
1
3
2
3
1
3
0
0
0
3
0
2
0
2
0
0
0
0
0
0
2
0
0
0
0
c
c
c
c
i
b
b
b
b
a
a
a
i
g
i
b
b
b
a
a
i
g
g
g
i
b
b
a
i
f
i
g
i
e
i
b
a
a
i
a
g
b
g
b
b
a
a
a
a
g
b
b
b
b
T
4,i
3,g
2,c
2,d
1,a
1,b
3,h
2,e
2,f
Highest fork = 3,g
W-destructible
Lowest value = 2
Illustration 3
F

1
1
1
1
3
0
0
0
0
0
0
0
3
2
3
0
0
0
0
0
3
2
2
2
3
0
0
0
3
1
3
2
3
1
3
0
0
0
3
0
2
0
2
0
0
0
0
0
0
2
0
0
0
0
c
c
c
c
i
b
b
b
b
a
a
a
i
g
i
b
b
b
a
a
i
g
g
g
i
b
b
a
i
f
i
g
i
e
i
b
a
a
i
a
g
b
g
b
b
a
a
a
a
g
b
b
b
b
T
4,i
3,g
2,c
2,d
1,a
1,b
3,h
2,e
2,f
No highest fork
W-destructible
Lowest value = 0
How can we reduce the
complexity ?
Two fundamental ideas:
1/ Find a characterization of W-destructible
points which can be checked in constant
time
2/ Find strategies which guarantee that each
point is examined at most once
W-thinning algorithm
The outline of a W-thinning algorithm is:
Repeat until stability
Select a W-destructible point p,
according to a certain criterion
Lower the value of p
In order to ensure a linear time complexity, we must
avoid multiple selections of the same point.
W-thinning algorithm
M-thinning
Recall that a point p is M-destructible for F if it is
W-destructible for F and if it may become a
minimal point after W-lowering.
If an M-destructible point p is W-lowered down to
the value of an adjacent minimum, then we say
that p is M-lowered.
Obviously, a minimal point will never become
W-destructible in further steps of a W-thinning
process (recall the transition graph).
M-thinning
Let F, G in F(V).
We say that G is an M-thinning of F
if G may be obtained from F by iteratively
M-lowering some M-destructible points.
We say that G is an M-watershed of F
if G is an M-thinning of F and
if G has no M-destructible point.
Property
Let F in F(V), let G be a an M-watershed
of F.
Any W-thinning of G has exactly the same
regional minima as G.
Illustration
9
0
0
3
0
0
9
0
3
2
3
0
1
9
4
3
0
0
1
9
5
4
7
7
1
1
9
7
2
2
1
1
9
2
2
2
0
,
Minima (
Crest (
9
Other (
,
1
,
7
5
,
,
4
)
2
3
)
)
Classification of transitions
separating
pre-inner, non M-destructible
inner, non minimal
pre-separating
pre-inner, M-destructible
inner, minimal
Illustration
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
2
7
7
7
1
2
2
1
2
5
6
7
7
5
1
0
0
2
8
3
3
4
7
4
4
3
4
7
3
0
1
8
5
0
0
9
5
3
1
4
4
7
5
5
6
4
2
0
2
4
8
0
0
2
9
4
1
3
7
3
4
4
3
6
3
1
2
8
4
0
0
2
5
7
8
7
1
1
2
2
1
1
6
6
7
4
2
0
0
0
0
0
0
0
0
0
0
F0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
7
7
7
0
0
0
0
0
0
6
7
6
7
6
0
0
0
0
0
8
7
1
1
1
7
0
0
0
0
7
6
0
0
0
8
6
0
0
0
9
7
1
1
1
1
1
7
0
0
6
0
0
0
0
0
8
6
0
0
0
9
7
1
1
1
7
0
0
0
0
6
0
0
0
8
6
0
0
0
0
0
7
8
7
7
0
0
0
0
0
0
6
6
7
6
0
0
0
0
0
0
0
0
0
0 0
0 0 of
0 of
M-watershed
Watershed
F0 F 0
0
0
0
0
0
Illustration
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
7
1
7
1
7
1
0
0
0
0
0
0
6
1
7
1
7
1
0
0
0
0
0
8
1
1
0
1
0
1
0
7
1
0
0
0
0
7
1
0
0
0
8
1
0
0
0
9
1
1
0
1
0
1
0
1
0
1
0
7
1
0
0
6
1
0
0
0
0
0
8
1
0
0
0
9
1
1
0
1
0
1
0
7
1
0
0
0
0
6
1
0
0
0
8
1
0
0
0
0
0
7
1
8
1
7
1
0
0
0
0
0
0
6
1
6
1
7
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
2
7
7
7
1
2
2
1
2
5
6
7
7
5
1
0
0
2
8
3
3
4
7
4
4
3
4
7
3
0
1
8
5
0
0
9
5
3
1
4
4
7
5
5
6
4
2
0
2
4
8
0
0
2
9
4
1
3
7
3
4
4
3
6
3
1
2
8
4
0
0
2
5
7
8
7
1
1
2
2
1
1
6
6
7
4
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Priority function
1
10
1 10
2 10
3 10
4 10
3 10
2 10
1
0
0
1
4
4
4
4
4
4
4
0
0
1
10
1 10
2 10
3 10
4 10
3 10
2 10
1
0
0
1
9
10
8
7
6
5
4
0
0
1
10
1 10
2 10
3 10
4 10
3 10
2 10
1
0
0
1
9
10
8
7
6
5
4
0
0
1
10
1 10
2 10
3 10
4 10
3 10
2 10
1
0
0
1
9
10
8
7
6
5
4
0
0
1
10
1 10
2 10
3 10
4 10
3 10
2 10
1
0
0
1
9
10
8
7
6
5
4
0
0
1
10
1 10
2 10
3 10
4 10
3 10
2 10
1
0
0
1
9
10
8
7
6
5
4
0
0
1
10
1 10
2 10
3 10
4 10
3 10
2 10
1
0
0
1
9
10
8
7
6
5
4
0
0
M-watershed algorithm
Watershed algorithm
Repeat until stability
Select a W-destructible point p,
according to a certain criterion
Lower the value of p
If we give the greatest priority to a W-destructible point
which may be W-lowered down to the lowest possible
value, we can prove that the same point cannot be
selected twice by the algorithm.
Watershed algorithm
Conclusion
For a binary watershed :
Component tree
building
M-thinning
Minima
labelling
O(n  e(n))
O(n)
O(n)
For a (grayscale) topological watershed :
Component tree
building
M-thinning
W-thinning
O(n  e(n))
O(n)
O(n)
Conclusion
•
•
•
•
•
•
First algorithm
Proved complexity and correctness
Fast
General (weighted graph)
The implementation is achievable
The pre-processing step (component tree
building) is also useful for filtering
purposes
Perspectives
•
•
•
•
Saliency (L. Najman)
Integration of the filtering step
Parallelism ?
Architecture ?
Algorithm (Najman and Couprie)
Type checking
Type checking
« Light » component tree
« Branch » vertices are deleted
Only forks and leaves are kept
Component mapping
Least common ancestor
D
A
B
lca(A,B,C,D)
C
Perspectives
•
•
•
•
•
Saliency (L. Najman)
Integration of the filtering step
Drop of water paradigm
Parallelism ?
Architecture ?
Quasi-linear algorithms for the
topological watershed
Michel Couprie
Contributors to this work
Gilles Bertrand
Michel Couprie
Laurent Najman