Quasi-linear algorithms for the topological watershed

Slides:



Advertisements
Similar presentations
Great Theoretical Ideas in Computer Science for Some.
Advertisements

Segmentation by Morphological Watersheds
Introduction to Graph Theory Instructor: Dr. Chaudhary Department of Computer Science Millersville University Reading Assignment Chapter 1.
Introduction to Graphs
Greedy Algorithms Greed is good. (Some of the time)
Determinization of Büchi Automata
Graphs Chapter 20 Data Structures and Problem Solving with C++: Walls and Mirrors, Carrano and Henry, © 2013.
Image Segmentation Image segmentation (segmentace obrazu) –division or separation of the image into segments (connected regions) of similar properties.
Lectures on Network Flows
Thresholding Otsu’s Thresholding Method Threshold Detection Methods Optimal Thresholding Multi-Spectral Thresholding 6.2. Edge-based.
1 7-MST Minimal Spanning Trees Fonts: MTExtra:  (comment) Symbol:  Wingdings: Fonts: MTExtra:  (comment) Symbol:  Wingdings:
CSE 421 Algorithms Richard Anderson Lecture 4. What does it mean for an algorithm to be efficient?
Graphs Chapter 20 Data Structures and Problem Solving with C++: Walls and Mirrors, Frank Carrano, © 2012.
Cross-section topology Michel Couprie Contributors: G. Bertrand M. Couprie J.C. Everat (PhD) F.N. Bezerra (PhD)
GRAPH Learning Outcomes Students should be able to:
Chapter 10, Part II Edge Linking and Boundary Detection The methods discussed in the previous section yield pixels lying only on edges. This section.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Ver Chapter 13: Graphs Data Abstraction & Problem Solving with C++
© 2006 Pearson Addison-Wesley. All rights reserved 14 A-1 Chapter 14 Graphs.
Great Theoretical Ideas in Computer Science for Some.
1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using.
Some links between min-cuts, optimal spanning forests and watersheds Cédric Allène, Jean-Yves Audibert, Michel Couprie, Jean Cousty & Renaud Keriven ENPC.
Lecture 12 Algorithm Analysis Arne Kutzner Hanyang University / Seoul Korea.
Lecture z Chapter 10: Image Segmentation. Segmentation approaches 1) Gradient based: How different are pixels? 2) Thresholding: Converts grey-level images.
IOI/ACM ICPC Training 4 June 2005.
Lecture ? The Algorithms of Kruskal and Prim
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Chapter 22 Elementary Graph Algorithms
Chapter 9 (Part 2): Graphs
Introduction to Algorithms
Chapter 5 : Trees.
Minimum Spanning Trees
Computing Connected Components on Parallel Computers
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Lectures on Network Flows
Great Theoretical Ideas in Computer Science
CS 3343: Analysis of Algorithms
Lecture 12 Algorithm Analysis
Greedy Algorithms / Minimum Spanning Tree Yin Tat Lee
CS202 - Fundamental Structures of Computer Science II
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Discrete Mathematics for Computer Science
CSE 421: Introduction to Algorithms
Lecture 10 Algorithm Analysis
Enumerating Distances Using Spanners of Bounded Degree
Minimum Spanning Tree.
Graphs Chapter 13.
Advanced Algorithms Analysis and Design
Elementary graph algorithms Chapter 22
Graphs Chapter 11 Objectives Upon completion you will be able to:
Algorithms and Data Structures Lecture XII
Data Structures – LECTURE 13 Minumum spanning trees
Lectures on Graph Algorithms: searching, testing and sorting
Discrete Math II Howon Kim
Lecture 12 Algorithm Analysis
A topological approach to watersheds
Graphs and Algorithms (2MMD30)
Minimum Spanning Tree.
A new definition for the dynamics
Lecture 14 Shortest Path (cont’d) Minimum Spanning Tree
Text Book: Introduction to algorithms By C L R S
A Block Based MAP Segmentation for Image Compression
Discrete Mathematics for Computer Science
Lecture 12 Algorithm Analysis
Computer and Robot Vision I
Chapter 14 Graphs © 2011 Pearson Addison-Wesley. All rights reserved.
Region-Based Segmentation
CS654: Digital Image Analysis
Lecture 13 Shortest Path (cont’d) Minimum Spanning Tree
Communication Driven Remapping of Processing Element (PE) in Fault-tolerant NoC-based MPSoCs Chia-Ling Chen, Yen-Hao Chen and TingTing Hwang Department.
Minimum Spanning Trees
Presentation transcript:

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 10 10 10 1 10 15 1 1 20 1 20 3 3 3 5 5 5 10 10 10 1 10 1 15 1 20 1 20 3 3 3 5 5 30 30 30 10 15 1 15 20 1 1 20 3 3 3 5 30 20 20 20 30 1 15 1 15 20 1 1 20 40 40 40 40 40 20 20 20 40 40 40 40 40 10 10 10 10 40 20 20 20 40 1 10 10 1 1 10 1 10 5 5 5 5 10 40 20 40 10 10 1 5 1 5 5 1 1 1 3 5 10 15 1 20 1 15 10 5 1 1 1 1 1 1 1 3 5 10 15 20 15 10 5 1 1 1 3 5 10 15 20 15 10 5 1

Flooding algorithm 3 3 3 3 3 3 5 5 5 10 10 10 1 10 1 15 1 20 20 1 3 3 3 3 3 3 5 5 5 10 10 10 10 1 15 1 20 1 1 20 3 3 3 3 3 3 5 5 30 30 30 10 1 15 15 20 1 1 20 3 3 3 3 3 3 5 30 20 20 20 30 15 1 1 15 20 1 20 1 40 40 40 40 40 20 20 20 40 40 40 40 40 10 10 10 10 40 20 20 20 40 1 10 1 10 1 10 10 1 5 5 5 5 10 40 20 40 10 10 1 5 5 1 5 1 1 1 1 1 3 5 10 1 15 20 1 15 10 5 1 1 1 1 1 1 1 1 1 3 5 10 15 20 15 10 5 1 1 1 1 1 3 5 10 15 20 15 10 5 1

Flooding algorithm 3 3 3 3 3 3 3 3 3 5 5 5 10 10 10 10 1 15 1 1 20 20 1 3 3 3 3 3 3 3 3 3 5 5 5 10 10 10 10 1 15 1 20 1 20 1 3 3 3 3 3 3 3 3 3 5 5 30 30 30 10 15 1 15 1 20 20 1 3 3 3 3 3 3 3 3 3 5 30 20 20 20 30 15 1 15 1 1 20 20 1 40 40 40 40 40 20 20 20 40 40 40 40 40 10 10 10 10 40 20 20 20 40 10 1 10 1 1 10 10 1 5 5 5 5 10 40 20 40 10 10 1 5 1 5 1 5 1 1 3 5 10 15 1 20 1 15 10 5 1 1 1 1 1 1 1 3 5 10 15 20 15 10 5 1 1 1 3 5 10 15 20 15 10 5 1

Flooding algorithm 3 3 3 5 5 5 10 10 10 1 10 15 1 1 20 1 20 3 3 3 5 5 5 10 10 10 1 10 1 15 1 20 1 20 3 3 3 5 5 30 30 30 10 15 1 15 20 1 1 20 3 3 3 5 30 20 20 20 30 1 15 1 15 20 1 1 20 40 40 40 40 40 20 20 20 40 40 40 40 40 10 10 10 10 40 20 20 20 40 1 10 10 1 1 10 1 10 5 5 5 5 10 40 20 40 10 10 1 5 1 5 5 1 1 1 3 5 10 15 1 20 1 15 10 5 1 1 1 1 1 1 1 3 5 10 15 20 15 10 5 1 1 1 3 5 10 15 20 15 10 5 1

Flooding algorithm 3 3 3 5 5 5 10 10 10 1 10 15 1 1 20 1 20 3 3 3 5 5 5 10 10 10 1 10 1 15 1 20 1 20 3 3 3 5 5 30 30 30 10 15 1 15 20 1 1 20 3 3 3 5 30 20 20 20 30 1 15 1 15 20 1 1 20 40 40 40 40 40 20 20 20 40 40 40 40 40 10 10 10 10 40 20 20 20 40 1 10 10 1 1 10 1 10 5 5 5 5 10 40 20 40 10 10 1 5 1 5 5 1 1 1 3 5 10 15 1 20 1 15 10 5 1 1 1 1 1 1 1 3 5 10 15 20 15 10 5 1 1 1 3 5 10 15 20 15 10 5 1

Flooding algorithm 3 3 3 5 5 5 10 10 10 1 10 15 1 1 20 1 20 3 3 3 5 5 5 10 10 10 1 10 1 15 1 20 1 20 3 3 3 5 5 30 30 30 10 15 1 15 20 1 1 20 3 3 3 5 30 20 20 20 30 1 15 1 15 20 1 1 20 40 40 40 40 40 20 20 20 40 40 40 40 40 10 10 10 10 40 20 20 20 40 1 10 10 1 1 10 1 10 5 5 5 5 10 40 20 40 10 10 1 5 1 5 5 1 1 1 3 5 10 15 1 20 1 15 10 5 1 1 1 1 1 1 1 3 5 10 15 20 15 10 5 1 1 1 3 5 10 15 20 15 10 5 1

Flooding algorithm 3 3 3 5 5 5 10 10 10 10 1 15 1 1 20 20 1 3 3 3 5 5 5 10 10 10 10 1 15 1 20 1 20 1 3 3 3 5 5 30 30 30 10 1 15 15 20 1 1 20 3 3 3 5 30 20 20 20 30 15 1 1 15 1 20 20 1 40 40 40 40 40 20 20 20 40 40 40 40 40 10 10 10 10 40 20 20 20 40 10 1 10 1 1 10 1 10 5 5 5 5 10 40 20 40 10 10 1 5 5 1 5 1 1 1 3 5 10 15 1 20 1 15 10 1 5 1 1 1 1 1 1 3 5 10 15 20 15 10 5 1 1 1 3 5 10 15 20 15 10 5 1

Flooding algorithm 3 3 3 5 5 5 10 10 10 10 1 1 15 1 20 20 1 3 3 3 5 5 5 10 10 10 1 10 15 1 20 1 1 20 3 3 3 5 5 30 30 30 30 30 10 15 1 15 20 1 1 20 3 3 3 5 30 30 20 20 20 30 30 1 15 15 1 20 1 20 1 40 40 40 40 40 20 20 20 40 40 40 40 40 10 10 10 10 40 20 20 20 40 10 1 10 1 1 10 1 10 5 5 5 5 10 40 20 40 10 10 5 1 5 1 5 1 1 1 3 5 10 1 15 20 15 1 10 1 5 1 1 1 1 1 1 3 5 10 15 20 15 10 5 1 1 1 3 5 10 15 20 15 10 5 1

Flooding algorithm 3 3 3 5 5 5 10 10 10 10 1 1 15 20 1 20 1 3 3 3 5 5 5 10 10 10 10 1 15 1 20 1 1 20 3 3 3 5 5 30 30 30 10 15 1 15 20 1 1 20 3 3 3 5 30 20 20 20 30 15 1 1 15 1 20 1 20 40 40 40 40 40 20 20 20 40 40 40 40 40 10 10 10 10 40 20 20 20 40 1 10 10 1 10 1 1 10 5 5 5 5 10 40 20 40 10 10 1 5 1 5 5 1 1 1 3 5 10 1 15 20 15 1 10 5 1 1 1 1 1 1 1 3 5 10 15 20 15 10 5 1 1 1 3 5 10 15 20 15 10 5 1 There is no descending path from the 20s to the minimum 3 The contrast between minima is not preserved

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 10 10 10 1 10 15 1 1 20 1 20 3 3 3 5 5 5 10 10 10 1 10 1 15 1 20 1 20 3 3 3 5 5 30 30 30 10 15 1 15 20 1 1 20 3 3 3 5 30 20 20 20 30 1 15 1 15 20 1 1 20 40 40 40 40 40 20 20 20 40 40 40 40 40 10 10 10 10 40 20 20 20 40 1 10 10 1 1 10 1 10 5 5 5 5 10 40 20 40 10 10 1 5 1 5 5 1 1 1 3 5 10 15 1 20 1 15 10 5 1 1 1 1 1 1 1 3 5 10 15 20 15 10 5 1 1 1 3 5 10 15 20 15 10 5 1

W-destructible points 3 3 3 5 5 5 10 10 10 1 10 15 1 1 20 1 20 3 3 3 5 5 5 10 10 10 1 10 1 15 1 20 1 20 3 3 3 5 5 30 30 30 10 15 1 15 20 1 1 20 3 3 3 5 30 20 20 20 30 1 15 1 15 20 1 1 20 40 40 40 40 40 20 20 20 40 40 40 40 40 10 10 10 10 40 20 20 20 40 1 10 10 1 1 10 1 10 5 5 5 5 10 40 20 40 10 10 1 5 1 5 5 1 1 1 3 5 10 15 1 20 1 15 10 5 1 1 1 1 1 1 1 3 5 10 15 20 15 10 5 1 1 1 3 5 10 15 20 15 10 5 1

W-destructible points 3 3 3 5 5 5 10 10 10 1 10 15 1 1 20 1 20 3 3 3 5 5 5 10 10 10 1 10 1 15 1 20 1 20 3 3 3 5 5 30 30 30 10 15 1 15 20 1 1 20 3 3 3 5 30 20 20 20 30 1 15 1 15 20 1 1 20 40 40 40 40 40 20 20 20 40 40 40 40 40 10 10 10 10 40 20 20 20 40 1 10 10 1 1 10 1 10 5 5 5 5 10 40 20 40 10 10 1 5 1 5 5 1 1 1 3 5 10 15 1 20 1 15 10 5 1 1 1 1 1 1 1 3 5 10 15 20 15 10 5 1 1 1 3 5 10 15 20 15 10 5 1 F1

W-destructible points 3 3 3 5 5 5 10 10 10 1 10 15 1 1 20 1 20 3 3 3 5 5 5 10 10 10 1 10 1 15 1 20 1 20 3 3 3 5 5 30 30 30 10 15 1 15 20 1 1 20 3 3 3 5 30 20 20 20 30 1 15 1 15 20 1 1 20 40 40 40 40 40 20 20 20 40 40 40 40 40 10 10 10 10 40 20 20 20 40 1 10 10 1 1 10 1 10 5 5 5 5 10 40 20 40 10 10 1 5 1 5 5 1 1 1 3 5 10 15 1 20 1 15 10 5 1 1 1 1 1 1 3 5 10 15 20 15 10 5 1 1 1 3 5 10 15 20 15 10 5 1

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 10 10 10 1 10 15 1 1 20 1 20 3 3 3 5 5 5 10 10 10 1 10 1 15 1 20 1 20 3 3 3 5 5 30 30 30 10 15 1 15 20 1 1 20 3 3 3 5 30 20 20 20 30 1 15 1 15 20 1 1 20 40 40 40 40 40 20 20 20 40 40 40 40 40 10 10 10 10 40 20 20 20 40 1 10 10 1 1 10 1 10 5 5 5 5 10 40 20 40 10 10 1 5 1 5 5 1 1 1 3 5 10 15 1 20 1 15 10 5 1 1 1 1 1 1 3 5 10 15 20 15 10 5 1 1 1 3 5 10 15 20 15 10 5 1

Topological watershed 3 3 3 3 3 3 3 3 3 1 3 1 3 3 1 3 1 3 3 3 3 3 3 3 3 3 1 3 3 1 1 3 3 1 3 3 3 3 3 30 30 30 3 1 3 3 3 1 3 3 3 3 3 30 20 20 20 30 1 3 3 1 1 3 1 3 40 40 40 40 40 20 20 20 40 40 40 40 40 1 1 1 1 40 20 20 20 40 1 1 1 1 1 1 1 1 1 40 20 40 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 20

Topological watershed 3 3 3 3 3 3 3 3 3 1 3 1 3 3 1 3 1 3 3 3 3 3 3 3 3 3 1 3 3 1 1 3 3 1 3 3 3 3 3 30 30 30 3 1 3 3 3 1 3 3 3 3 3 30 20 20 20 30 1 3 3 1 1 3 1 3 40 40 40 40 40 20 20 20 40 40 40 40 40 1 1 1 1 40 20 20 20 40 1 1 1 1 1 1 1 1 1 40 20 40 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 20

Topological watershed 3 3 3 3 3 3 3 3 3 1 3 1 3 3 1 3 1 3 3 3 3 3 3 3 3 3 1 3 3 1 1 3 1 3 3 3 3 3 3 30 30 30 3 3 1 3 3 1 3 3 3 3 3 30 20 20 20 30 1 3 3 1 3 1 3 1 40 40 40 40 40 20 20 20 40 40 40 40 40 1 1 1 1 40 20 20 20 40 1 1 1 1 1 1 1 1 1 40 20 40 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 20 F40

Topological watershed 3 3 3 3 3 3 3 3 3 1 3 1 3 3 1 3 1 3 3 3 3 3 3 3 3 3 1 3 3 1 1 3 3 1 3 3 3 3 3 30 30 30 3 1 3 3 3 1 3 3 3 3 3 30 20 20 20 30 1 3 3 1 1 3 1 3 40 40 40 40 40 20 20 20 40 40 30 40 40 1 1 1 1 40 20 20 20 40 1 1 1 1 1 1 1 1 1 40 20 40 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 20

Topological watershed 3 3 3 3 3 3 3 3 3 1 3 1 3 3 1 3 1 3 3 3 3 3 3 3 3 3 1 3 3 1 1 3 1 3 3 3 3 3 3 30 30 30 3 3 1 3 3 1 3 3 3 3 3 30 20 20 20 30 1 3 3 1 3 1 3 1 40 40 40 40 40 20 20 20 40 40 30 40 40 1 1 1 1 40 20 20 20 40 1 1 1 1 1 1 1 1 1 40 20 40 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 20 F30

Topological watershed 3 3 3 3 3 3 3 3 3 1 3 1 3 3 1 3 1 3 3 3 3 3 3 3 3 3 1 3 3 1 1 3 3 1 3 3 3 3 3 30 30 30 3 1 3 3 3 1 3 3 3 3 3 30 20 20 20 30 1 3 3 1 1 3 1 3 40 40 40 40 40 20 20 20 40 40 30 40 40 1 1 1 1 40 20 20 20 40 1 1 1 1 1 1 1 1 1 40 20 40 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 20

Topological watershed 3 1 30 30 30 30 20 20 20 30 40 40 40 40 40 20 20 20 40 40 30 40 40 1 40 20 20 1 20 40 40 20 40 20 20 20 F20

Topological watershed 3 3 3 3 3 3 3 3 3 1 3 3 1 1 3 3 1 3 3 3 3 3 3 3 3 3 1 3 3 1 3 1 1 3 3 3 3 3 3 30 30 30 3 3 1 3 3 1 3 3 3 3 3 30 20 30 3 1 3 1 3 1 1 3 40 40 40 40 40 40 40 30 40 40 1 1 1 1 40 40 1 1 1 1 1 1 1 1 1 40 40 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Topological watershed 3 20 1 3 3 3 3 3 3 3 3 3 1 3 3 1 3 1 3 1 3 3 3 3 3 3 3 3 3 3 1 3 1 1 3 1 3 3 3 3 3 3 30 30 30 3 3 1 3 3 1 3 3 3 3 3 30 30 3 1 1 3 3 1 3 1 40 40 40 40 40 40 40 30 40 40 1 1 1 1 40 40 1 1 1 1 1 1 1 1 1 40 40 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 F30

Topological watershed 3 3 3 3 3 3 3 3 3 1 3 1 3 3 1 3 1 3 3 3 3 3 3 3 3 3 1 3 3 1 1 3 3 1 3 3 3 3 3 30 30 30 3 1 3 3 3 1 3 3 3 3 3 30 20 20 20 30 1 3 3 1 1 3 1 3 40 40 40 40 40 20 20 20 40 40 30 40 40 1 1 1 1 40 20 20 20 40 1 1 1 1 1 1 1 1 1 40 20 40 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 20

Topological watershed 3 3 3 3 3 3 3 3 3 1 3 1 3 3 1 3 1 3 3 3 3 3 3 3 3 3 1 3 3 1 1 3 1 3 3 3 3 3 3 30 30 30 3 3 1 3 3 1 3 3 3 3 3 30 20 20 20 30 1 3 3 1 3 1 3 1 40 40 40 40 40 20 20 20 40 40 40 40 40 1 1 1 1 40 20 20 20 40 1 1 1 1 1 1 1 1 1 40 20 40 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 20 F40

Topological watershed 3 3 3 3 3 3 3 3 3 1 3 1 3 3 1 3 1 3 3 3 3 3 3 3 3 3 1 3 3 1 1 3 1 3 3 3 3 3 3 30 30 30 3 3 1 3 3 1 3 3 3 3 3 30 20 20 20 30 1 3 3 1 3 1 3 1 40 40 40 40 40 20 20 20 40 40 40 40 40 1 1 1 1 30 20 20 20 30 1 1 1 1 1 1 1 1 1 30 20 30 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 20 F30

Topological watershed 3 3 3 3 3 3 3 3 3 1 3 1 3 3 1 3 1 3 3 3 3 3 3 3 3 3 1 3 3 1 1 3 1 3 3 3 3 3 3 30 30 30 3 3 1 3 3 1 3 3 3 3 3 30 20 20 20 30 1 3 3 1 3 1 3 1 40 40 40 40 40 20 20 20 40 40 40 40 40 1 1 1 1 20 20 20 20 20 1 1 1 1 1 1 1 1 1 20 20 20 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 20 F20

Topological watershed 3 3 3 3 3 3 3 3 3 1 3 1 3 3 1 3 1 3 3 3 3 3 3 3 3 3 1 3 3 1 1 3 3 1 3 3 3 3 3 30 30 30 3 1 3 3 3 1 3 3 3 3 3 30 20 20 20 30 1 3 3 1 1 3 1 3 40 40 40 40 40 20 20 20 40 40 30 40 40 1 1 1 1 1 20 20 20 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 20

Topological watershed 3 3 3 3 3 3 3 3 3 3 1 1 3 3 1 3 1 3 3 3 3 3 3 3 3 3 3 1 3 1 1 3 3 1 3 3 3 3 3 30 30 30 3 1 3 3 3 1 3 3 3 3 3 30 20 20 20 30 3 1 3 1 1 3 1 3 40 40 40 40 40 20 20 20 40 40 30 40 40 1 1 1 1 1 20 20 20 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 20

Topological watershed 3 3 3 3 3 3 3 3 3 1 3 3 1 1 3 3 1 3 3 3 3 3 3 3 3 3 1 3 3 1 3 1 3 1 3 3 3 3 3 30 30 30 3 3 1 3 3 1 3 3 3 3 3 30 1 20 30 3 1 3 1 1 3 1 3 30 30 30 30 1 1 20 30 30 30 30 1 1 1 1 1 1 20 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 20

Topological watershed 3 3 3 3 3 3 3 3 3 1 3 3 1 1 3 1 3 3 3 3 3 3 3 3 3 3 3 1 3 1 3 1 1 3 3 3 3 3 3 30 30 30 3 3 1 3 3 1 3 3 3 3 3 30 1 20 30 3 1 1 3 3 1 3 1 30 30 30 30 1 1 20 30 30 30 30 1 1 1 1 1 1 20 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 20 The watershed is located on the crest lines of the original image The contrast between minima is preserved

W-thinning paradigm

Algorithms

Naive watershed algorithm Repeat For each point p in V n If p is W-destructible n2 F(p) = F(p)-1 Until stability 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) 9 1 8 6 5 7 2 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) 9 1 8 6 5 7 2 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) 9 1 8 6 5 7 2 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) 9 1 8 6 5 7 2 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) 9 1 8 6 5 7 2 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) 9 1 8 6 5 7 2 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 crest flat W-destructible separating pre-separating pre-inner inner M-destructible non-M-destructible pre-inner minimal non-minimal inner

Transitions (1) 9 1 8 6 5 7 2 3 5 pre-separating separating

pre-inner, M-destructible Transitions (2) 9 1 8 6 5 7 2 3 pre-inner, M-destructible inner, minimal

pre-inner, non M-destructible Transitions (3) 9 1 8 6 5 7 2 3 8 pre-inner, non M-destructible inner, non minimal

Transitions (4) 9 1 8 6 5 7 2 3 pre-separating separating

pre-inner, M-destructible Transitions (5) 9 1 8 6 5 7 2 3 2 pre-inner, M-destructible pre-separating

pre-inner, M-destructible Transitions (6) 9 1 8 6 5 7 2 3 pre-inner, M-destructible separating

Transitions (7) pre-inner, non M-destructible 9 1 8 6 5 7 2 3 1 pre-inner, non M-destructible pre-inner, M-destructible

pre-inner, non M-destructible Transitions (8) 9 1 8 6 5 7 2 3 2 pre-inner, non M-destructible pre-separating

pre-inner, non M-destructible Transitions (9) 9 1 8 6 5 7 2 3 pre-inner, non M-destructible separating

pre-inner, non M-destructible Transitions (10) 9 1 8 6 5 7 2 3 7 inner, non minimal pre-inner, non M-destructible

pre-inner, M-destructible Transitions (11) 9 1 8 6 5 7 2 3 2 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-separating pre-inner, non M-destructible pre-inner, M-destructible inner, non minimal 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 x y 40 1 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 40 40 35 10 30 15 15 15 35 31 36 10 40 40 10 8 5 10 32 33 34 10 10 15 38 40 40 8 5 1 1 15 40 10 6 3 15 20 40 40 10 8 5 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 y x x and y are 20-separated 40 40 40 40 40 40 40 40 40 1 1 2 3 10 5 25 5 4 4 4 40 x y 40 1 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 40 40 35 10 30 15 15 15 35 31 36 10 40 40 10 8 5 10 32 33 34 10 10 15 38 40 40 8 5 1 1 15 40 10 6 3 15 20 40 40 10 8 5 10 15 35 15 6 6 15 35 40 40 40 40 40 40 40 40 40 40 40 40 40 40

x and y are NOT separated (they are linked) 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 2 8 6 5 5 20 3 2 3 40 x y 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 40 40 35 10 30 15 15 15 35 31 36 10 40 40 10 8 5 10 32 33 34 10 10 15 38 40 40 8 5 1 1 15 40 10 6 3 15 20 40 40 10 8 5 10 15 35 15 6 6 15 35 40 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 x y F(x,y) = 20 3 3 3 5 5 5 10 10 10 1 10 1 15 20 1 1 20 30 30 30 10 1 15 15 20 1 20 1 3 3 3 5 30 20 20 20 30 1 15 1 15 1 20 20 1 40 40 40 40 40 20 20 20 40 40 40 40 40 10 10 10 10 40 20 20 20 40 10 1 10 1 10 1 10 1 5 5 5 5 10 40 20 40 10 10 5 1 1 5 5 1 1 1 3 5 10 15 20 15 10 1 5 1 1 1 1 1 1 3 5 10 x 15 20 15 y 10 5 1 1 1 3 5 10 15 20 15 10 5 1 F(x,y) = 20

Illustration 3 3 3 5 5 5 10 10 10 10 1 1 15 20 1 1 20 3 3 3 5 5 5 10 10 10 10 1 15 1 20 1 1 20 3 3 3 5 5 30 30 30 10 1 15 15 1 20 1 20 3 3 3 5 30 20 20 20 30 1 15 1 15 1 20 1 20 40 40 40 40 40 20 20 20 40 40 40 40 40 10 10 10 10 40 20 20 20 40 10 1 1 10 10 1 10 1 5 5 5 5 10 40 20 40 10 10 5 1 5 1 1 5 1 1 3 5 10 1 15 20 1 15 10 5 1 1 1 1 1 1 1 3 5 10 15 20 15 10 5 1 1 1 3 5 10 15 20 15 10 5 1 F(x,y) = 20

Illustration 3 3 3 5 5 5 10 10 10 10 1 1 15 20 1 1 20 3 3 3 5 5 5 10 10 10 10 1 15 1 20 1 1 20 3 3 3 5 5 30 30 30 10 1 15 15 1 20 1 20 3 3 3 5 30 20 20 20 30 1 15 1 15 1 20 1 20 40 40 40 40 40 20 20 20 40 40 40 40 40 10 10 10 10 40 20 20 20 40 10 1 1 10 10 1 10 1 5 5 5 5 10 40 20 40 10 10 5 1 5 1 1 5 1 1 3 5 10 1 15 20 1 15 10 5 1 1 1 1 1 1 1 3 5 10 15 20 15 10 5 1 1 1 3 5 10 15 20 15 10 5 1 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 3,g 1,b T 4,i 1,a F 3,g 3,h 2,f 2,c 2,d 2,e 2,f 1,a 1,b  3,g 3 1,b T 4,i 1,a 2 3 3 3 3 F 3,g 3,h 3 1 2,f 1 3 3 1 3 3 2,c 2,d 2,e 2,f c c c c i b b b b 1,a 1,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

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

(proper lca: different from both A and B) 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 2 3 4 5 6 1 11 15 33 32 2 10 12 14 16 3 5 9 25 31 17 13 18 22 24 28 30 26 6 8 4 19 21 23 27 29 7 20

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 B A C D hfork(A,B,C,D)

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 Highest fork = 3,g Not W-destructible T 4,i F 3,g 3,h 2 1 3 T 4,i 3 3 3 2 2 3 F 3,g 3,h 3 1 3 2 1 3 1 3 3 2 2 2 2,c 2,d 2,e 1,b 2,e 2,f 2 c c c c i b b b b 1,a 1,b a a a i g i b b b Highest fork = 3,g a a i g g g i b b  a i f i g i e i b Not W-destructible a a i a g b g b b a a a a g b b b b

Illustration 2 Highest fork = 3,g W-destructible Lowest value = 2 T 1 1 1 2 1 3 T 4,i 3 1 2 3 3 2 2 3 3 F 3,g 3,g 2,e 1,b 3,h 3 1 3 2 3 1 3 3 2 2 2,c 2,d 2,e 2,f 2 c c c c i b b b b 1,a 1,b a a a i g i b b b Highest fork = 3,g a a i g g g i b b  a i f i g i e i b W-destructible a a i a g b g b b Lowest value = 2 a a a a g b b b b

Illustration 3 No highest fork W-destructible Lowest value = 0 T 4,i F 1 1 1 2 1 2 1 3 T 4,i 3 3 3 3 2 2 3 F 3,g 2,c 1,a 3,g 3,h 3 1 3 2 3 1 3 3 2 2 2,c 2,d 2,e 2,f 2 c c c c i b b b b 1,a 1,b a a a i g i b b b No highest fork a a i g g g i b b  a i f i g i e i b W-destructible a a i a g b g b b Lowest value = 0 a a a a g b b b b

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 Minima ( , , ) Crest ( , , ) Other ( , ) 9 3 9 3 2 3 1 9 3 9 3 2 3 1 9 4 3 1 9 5 4 7 7 1 1 9 7 2 2 1 1 9 2 2 2 Minima ( , , ) 1 2 Crest ( , , ) 9 7 3 Other ( , ) 5 4

Classification of transitions separating pre-separating pre-inner, non M-destructible pre-inner, M-destructible inner, non minimal inner, minimal

Illustration F Watershed of F M-watershed of F 1 2 9 8 5 7 3 4 6 1 7 6 1 2 9 8 5 7 3 4 6 F 1 7 6 Watershed of F 9 8 7 6 1 M-watershed of F

Illustration 9 8 7 6 1 1 1 2 9 8 5 7 3 4 6

Priority function 1 10 1 2 3 4 1 4 5 6 7 8 9 10

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 Minima labelling M-thinning 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 lca(A,B,C,D) D A C B

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