Connected operators
Jean Cousty MorphoGraphs and Imagery
2011
Introduction: a problem seen during practical session
Problem: Fill the holes of the cells
Closing by a structuring element, Holes are closed
But contours “have moved”
A connected closing by reconstruction
Introduction: a problem seen during practical session
Problem: Fill the holes of the cells Closing by a structuring element,
Holes are closed
But contours “have moved”
A connected closing by reconstruction
Introduction: a problem seen during practical session
Problem: Fill the holes of the cells Closing by a structuring element,
Holes are closed
But contours “have moved”
A connected closing by reconstruction
Outline of the lecture
1 Connectivity: reminder
2 Connected openings/closings: the case of sets
3 Connected opening: the case of grayscale images
4 Component tree
Connectivity: reminder
Connexit´ e
E is a set
G = (E, Γ) is a graph
Connectivity: reminder
Connected components of a set
Definition
Let X ⊆ E
The subgraph of G induced by X is the graph (X , Γ X ) such that
− →
Γ
X= {(x, y) ∈ − →
Γ | x ∈ X , y ∈ X }
A connected component of the subgraph of G induced by X is simply called a connected component of X
C X denotes the set of all connected components of X
X ⊆ E (in black)
(E = Z 2 et Γ = Γ 4 )
Connectivity: reminder
Connected components of a set
Definition
Let X ⊆ E
The subgraph of G induced by X is the graph (X , Γ X ) such that
− →
Γ
X= {(x, y) ∈ − →
Γ | x ∈ X , y ∈ X }
A connected component of the subgraph of G induced by X is simply called a connected component of X
C X denotes the set of all connected components of X
X ⊆ E (in black)
(E = Z 2 et Γ = Γ 4 )
Connectivity: reminder
Connected components of a set
Definition
Let X ⊆ E
The subgraph of G induced by X is the graph (X , Γ X ) such that
− →
Γ
X= {(x, y) ∈ − →
Γ | x ∈ X , y ∈ X }
A connected component of the subgraph of G induced by X is simply called a connected component of X
C X denotes the set of all connected components of X
Partition of X into connected components
(E = Z 2 et Γ = Γ 4 )
Connectivity: reminder
Connected components of a set
Definition
Let X ⊆ E
The subgraph of G induced by X is the graph (X , Γ X ) such that
− →
Γ
X= {(x, y) ∈ − →
Γ | x ∈ X , y ∈ X }
A connected component of the subgraph of G induced by X is simply called a connected component of X
C X denotes the set of all connected components of X
(E = Z 2 et Γ = Γ 4 )
Connected openings/closings: the case of sets
Connected openings/closings
Definition
A filter γ on E is a connected opening if
∀X ∈ P(E ), C
γ(X)⊆ C
XA filter φ on E is a connected closing if
∀X ∈ P(E ), C
γ(X)⊆ C
XProperty
A connected opening γ is an opening
∀X , Y ∈ P(E ), X ⊆ Y = ⇒ γ(X ) ⊆ γ(Y ) (increasing)
∀X ∈ P(E ), γ(γ(X )) = γ(X) (idempotent)
∀X ∈ P(E ), γ(X ) ⊆ X (anti-axtensive)
Connected openings/closings: the case of sets
Connected openings/closings
Definition
A filter γ on E is a connected opening if
∀X ∈ P(E ), C
γ(X)⊆ C
XA filter φ on E is a connected closing if
∀X ∈ P(E ), C
γ(X)⊆ C
XProperty
A connected opening γ is an opening
∀X, Y ∈ P(E ), X ⊆ Y = ⇒ γ(X ) ⊆ γ(Y ) (increasing)
∀X ∈ P(E ), γ(γ(X )) = γ(X ) (idempotent)
∀X ∈ P(E ), γ(X ) ⊆ X (anti-axtensive)
Connected openings/closings: the case of sets
Connected openings/closings
Definition
A filter γ on E is a connected opening if
∀X ∈ P(E ), C
γ(X)⊆ C
XA filter φ on E is a connected closing if
∀X ∈ P(E ), C
γ(X)⊆ C
XProperty
A connected closing γ is a closing
∀X, Y ∈ P(E ), X ⊆ Y = ⇒ γ(X ) ⊆ γ(Y ) (increasing)
∀X ∈ P(E ), γ(γ(X )) = γ(X ) (idempotence)
∀X ∈ P(E ), X ⊆ γ(X ) (extensive)
Connected openings/closings: the case of sets
Example: area connected opening
Definition
Let λ ∈ N
The area connected opening of parameter λ is the operator α λ on E defined by
∀X ∈ P(E ), α
λ(X ) = ∪{C ∈ C
X| |C| ≥ λ}
X ⊆ E
(E = Z 2 et Γ = Γ 4 )
Connected openings/closings: the case of sets
Example: area connected opening
Definition
Let λ ∈ N
The area connected opening of parameter λ is the operator α λ on E defined by
∀X ∈ P(E ), α
λ(X ) = ∪{C ∈ C
X| |C| ≥ λ}
X ⊆ E
(E = Z 2 et Γ = Γ 4 )
Connected openings/closings: the case of sets
Example: area connected opening
Definition
Let λ ∈ N
The area connected opening of parameter λ is the operator α λ on E defined by
∀X ∈ P(E ), α
λ(X ) = ∪{C ∈ C
X| |C| ≥ λ}
α 1 (X )
(E = Z 2 et Γ = Γ 4 )
Connected openings/closings: the case of sets
Example: area connected opening
Definition
Let λ ∈ N
The area connected opening of parameter λ is the operator α λ on E defined by
∀X ∈ P(E ), α
λ(X ) = ∪{C ∈ C
X| |C| ≥ λ}
α 2 (X )
(E = Z 2 et Γ = Γ 4 )
Connected openings/closings: the case of sets
Example: area connected opening
Definition
Let λ ∈ N
The area connected opening of parameter λ is the operator α λ on E defined by
∀X ∈ P(E ), α
λ(X ) = ∪{C ∈ C
X| |C| ≥ λ}
α 13 (X )
(E = Z 2 et Γ = Γ 4 )
Connected openings/closings: the case of sets
Example: connected opening by reconstruction
Definition
Let M ⊆ E
The opening by reconstruction of (the marker) M is the operator ψ M on E defined by
∀X ∈ P(E ), ψ
M(X ) = ∪{C ∈ C
X| M ∩ C 6= ∅}
X ⊆ E et M (hatched dots)
(E = Z 2 et Γ = Γ 4 )
Connected openings/closings: the case of sets
Example: connected opening by reconstruction
Definition
Let M ⊆ E
The opening by reconstruction of (the marker) M is the operator ψ M on E defined by
∀X ∈ P(E ), ψ
M(X ) = ∪{C ∈ C
X| M ∩ C 6= ∅}
X ⊆ E
et M (hatched dots)
(E = Z 2 et Γ = Γ 4 )
Connected openings/closings: the case of sets
Example: connected opening by reconstruction
Definition
Let M ⊆ E
The opening by reconstruction of (the marker) M is the operator ψ M on E defined by
∀X ∈ P(E ), ψ
M(X ) = ∪{C ∈ C
X| M ∩ C 6= ∅}
0000 111100
11 00 11 00 11 0000 1111 0000 1111 00 11 00 11
0000 00 1111 11 0000 00 1111 11
00 11
X ⊆ E et M (hatched dots)
(E = Z 2 et Γ = Γ 4 )
Connected openings/closings: the case of sets
Example: connected opening by reconstruction
Definition
Let M ⊆ E
The opening by reconstruction of (the marker) M is the operator ψ M on E defined by
∀X ∈ P(E ), ψ
M(X ) = ∪{C ∈ C
X| M ∩ C 6= ∅}
0000 111100
11 00 11 00 11 0000 1111 0000 1111 00 11 00 11
0000 00 1111 11 0000 00 1111 11
00 11
ψ M (X )
(E = Z 2 et Γ = Γ 4 )
Connected openings/closings: the case of sets
Properties of connected filters
Property
γ is a connected opening ⇔ ?γ is a connected closing
Property (contour preservation)
If γ is a connected opening or closing, then
∀X ∈ P(E ), ∀(x, y) ∈ − → Γ ,
|{x, y} ∩ γ(X )| = 1 = ⇒ |{x , y } ∩ X | = 1
Connected openings/closings: the case of sets
Properties of connected filters
Property
γ is a connected opening ⇔ ?γ is a connected closing
Property (contour preservation)
If γ is a connected opening or closing, then
∀X ∈ P(E ), ∀(x, y) ∈ − → Γ ,
|{x, y} ∩ γ(X )| = 1 = ⇒ |{x , y } ∩ X | = 1
Connected opening: the case of grayscale images
Grayscale connected opening/closing
Definition (connected opening)
An operator γ on I is a connected opening (on I) if
∀F ∈ I , γ(γ(F )) = γ(F) (idempotence)
∀F, H ∈ I, ∀k ∈ Z , F
k⊆ H
k= ⇒ γ(F)
k⊆ γ(H)
k(increasing)
∀F ∈ I , ∀k ∈ Z , C
[γ(F)k]⊆ C
[Fk](connected, anti-extensive)
Definition (connected closing)
An operator γ on I is a connected closing (on I ) if
∀F ∈ I , γ(γ(F )) = γ(F) (idempotence)
∀F, H ∈ I, ∀k ∈ Z , F
k⊆ H
k= ⇒ γ(F )
k⊆ γ(H)
k(increasing)
∀F ∈ I , ∀k ∈ Z , C
[γ(F)k]
⊆ C
[Fk]
(connected, extensive)
Connected opening: the case of grayscale images
Grayscale connected opening/closing
Definition (connected opening)
An operator γ on I is a connected opening (on I) if
∀F ∈ I , γ(γ(F )) = γ(F) (idempotence)
∀F, H ∈ I, ∀k ∈ Z , F
k⊆ H
k= ⇒ γ(F)
k⊆ γ(H)
k(increasing)
∀F ∈ I , ∀k ∈ Z , C
[γ(F)k]⊆ C
[Fk](connected, anti-extensive)
Definition (connected closing)
An operator γ on I is a connected closing (on I) if
∀F ∈ I , γ(γ(F )) = γ(F) (idempotence)
∀F, H ∈ I, ∀k ∈ Z , F
k⊆ H
k= ⇒ γ(F)
k⊆ γ(H)
k(increasing)
∀F ∈ I , ∀k ∈ Z , C
[γ(F)k]
⊆ C
[Fk]
(connected, extensive)
Connected opening: the case of grayscale images
Examples
The stack operator induced by α λ (where λ ∈ N) is a connected opening on I
The stack operator induced by ψ M (where M ⊆ E ) is a connected opening on I
The stack operator induced by any connected opening on E is a connected opening on I
I Altitudes
E
∀x ∈ {x, − + 1}
Connected components of the level sets (red)
J. Cousty : MorphoGraph and Imagery 11/28
Connected opening: the case of grayscale images
Examples
The stack operator induced by α λ (where λ ∈ N) is a connected opening on I
The stack operator induced by ψ M (where M ⊆ E ) is a connected opening on I
The stack operator induced by any connected opening on E is a connected opening on I
Altitudes
I
E
E = Z, ∀x ∈ E, Γ(x) = {x, x − 1, x + 1}
J. Cousty : MorphoGraph and Imagery 11/28
Connected opening: the case of grayscale images
Examples
The stack operator induced by α λ (where λ ∈ N) is a connected opening on I
The stack operator induced by ψ M (where M ⊆ E ) is a connected opening on I
The stack operator induced by any connected opening on E is a connected opening on I
Altitudes
I
E
E = Z, ∀x ∈ E, Γ(x) = {x, x − 1, x + 1}
J. Cousty : MorphoGraph and Imagery 11/28
Connected opening: the case of grayscale images
Examples
The stack operator induced by α λ (where λ ∈ N) is a connected opening on I
The stack operator induced by ψ M (where M ⊆ E ) is a connected opening on I
The stack operator induced by any connected opening on E is a connected opening on I
Altitudes
I
E
E = Z, ∀x ∈ E, Γ(x) = {x, x − 1, x + 1}
J. Cousty : MorphoGraph and Imagery 11/28
Connected opening: the case of grayscale images
Examples
The stack operator induced by α λ (where λ ∈ N) is a connected opening on I
The stack operator induced by ψ M (where M ⊆ E) is a connected opening on I
The stack operator induced by any connected opening on E is a connected opening on I
Altitudes
I
E
E = Z, ∀x ∈ E, Γ(x) = {x, x − 1, x + 1}
J. Cousty : MorphoGraph and Imagery 11/28
Connected opening: the case of grayscale images
Examples
The stack operator induced by α λ (where λ ∈ N) is a connected opening on I
The stack operator induced by ψ M (where M ⊆ E) is a connected opening on I
The stack operator induced by any connected opening on E is a connected opening on I
Altitudes
I
E
E = Z, ∀x ∈ E, Γ(x) = {x, x − 1, x + 1}
J. Cousty : MorphoGraph and Imagery 11/28
Connected opening: the case of grayscale images
Grayscale connected opening
Definition
Let F ∈ I
The opening by reconstruction of (the marker) F is the operator ψ F on I defined by
∀H ∈ I , ∀k ∈ Z , [ψ
F(H)]
k= ψ
[Fk](H
k)
E Altitudes
H F
H in black, F in blue
Connected opening: the case of grayscale images
Grayscale connected opening
Definition
Let F ∈ I
The opening by reconstruction of (the marker) F is the operator ψ F on I defined by
∀H ∈ I , ∀k ∈ Z , [ψ
F(H)]
k= ψ
[Fk](H
k)
E Altitudes
H F
H in black, F in blue
Connected opening: the case of grayscale images
Grayscale connected opening
Definition
Let F ∈ I
The opening by reconstruction of (the marker) F is the operator ψ F on I defined by
∀H ∈ I , ∀k ∈ Z , [ψ
F(H)]
k= ψ
[Fk](H
k)
E F
Altitudes
H
ψ F (H) (in black)
Connected opening: the case of grayscale images
Properties
Property (duality)
An operator φ is a connected closing on I if and only if its dual ?φ is a connected opening on I, where
∀F ∈ I , ?φ(F) = −φ(−F )
Property (contour preservation)
If γ is a connected opening or closing on I, then
∀F ∈ I , ∀(x , y ) ∈ − →
Γ , γ(F)(x) 6= γ(F )(y ) = ⇒ F (x) 6= F(y )
Connected opening: the case of grayscale images
Properties
Property (duality)
An operator φ is a connected closing on I if and only if its dual ?φ is a connected opening on I, where
∀F ∈ I , ?φ(F) = −φ(−F )
Property (contour preservation)
If γ is a connected opening or closing on I, then
∀F ∈ I , ∀(x , y ) ∈ − →
Γ , γ(F)(x) 6= γ(F )(y ) = ⇒ F (x) 6= F(y )
Component tree
Component tree
Probl` eme
How to implement a connected operator?
Data structure: component tree How to build other connected operators?
Criterion on the nodes of the component tree
Component tree
Notation
In the following, the symbol I denotes a grayscale image
on E: I ∈ I
Component tree
Connected component of an image
Definition
We denote by C I the union of the sets of connected components of the level sets of I
C
I= ∪{C
[Ik]| k ∈ Z }
Each element in C I is called a connected component of I
Altitudes
I
E
Components of I (bold red lines)
Component tree
Component tree
Definition
Let C 1 and C 2 be two components of I in C I We say that C 1 is a child of C 2 (for I) if
C
1⊆ C
2∀C
0∈ C
I, if C
1⊆ C
0⊆ C
2then C
0= C
2or C
0= C
1The component tree of I is the graph A I = (C I , Γ I ) such that (C
1, C
2) ∈ Γ
Iif C
2is a child of C
1Altitudes
I
The relation “is child of” is
represented by red arrows
Component tree
Component tree
Definition
Let C 1 and C 2 be two components of I in C I We say that C 1 is a child of C 2 (for I) if
C
1⊆ C
2∀C
0∈ C
I, if C
1⊆ C
0⊆ C
2then C
0= C
2or C
0= C
1The component tree of I is the graph A I = (C I , Γ I ) such that (C
1, C
2) ∈ Γ
Iif C
2is a child of C
1Altitudes
I
The relation “is child of” is
represented by red arrows
Component tree
Arborescence
Property
If the graph (E , Γ) is connected, then the component tree of I is an arborescence of root E
Altitudes
I
E
Component tree
Simplifying an image by razings
A leaf of the component tree A I of I is called a regional maximum of I
A leaf of the component tree A −I of −I is called a regional minimum of I
Given a criterion, it is possible to iteratively remove the leaves of the tree A I
Such removal is called a razing
Component tree
Razing: intuition
Altitudes
I
E
Successive razing steps
A maximum has been removed
Component tree
Razing: intuition
Altitudes
I
E
Successive razing steps
A maximum has been removed
Component tree
Razing: intuition
Altitudes
I
E
Successive razing steps
A maximum has been removed
Component tree
Razing: intuition
Altitudes
I
E
Successive razing steps
A maximum has been removed
Component tree
Razing: definition
Definition
Let x ∈ E
The elementary razing ν x of I at x is defined b
[ν
x(I )](y) = I (y) − 1 if x and y belong to a same maximum of I [ν
x(I )](y) = I (y) otherwise
An image obtained from I by composition of elementary razings is
called a razing of I
Component tree
Simplifying an image by razings
What criterion (attribute) for selecting a maxima to raze?
Component tree
Razing by area
Altitudes
I
E
surface
Component tree
Razing by depth, or dynamics
Altitudes
I
E
profondeur
Component tree
Razing by volume
volume
E Altitudes
I
Component tree
Flooding
The dual of a razing is called a flooding
A flooding removes minima by iteratively increasing their values
Property (contour preservation)
If F is a razing or a flooding of I , then
∀(x , y ) ∈ − →
Γ , F(x ) 6= F (y) = ⇒ I (x) 6= I (y )
Remark. An operator produces razings is not necessarily an opening
(counter-examples: razing by dynamics or volume)
Component tree
Flooding
The dual of a razing is called a flooding
A flooding removes minima by iteratively increasing their values
Property (contour preservation)
If F is a razing or a flooding of I , then
∀(x , y ) ∈ − →
Γ , F(x) 6= F (y) = ⇒ I (x ) 6= I (y )
Remark. An operator produces razings is not necessarily an opening
(counter-examples: razing by dynamics or volume)
Component tree
Flooding
The dual of a razing is called a flooding
A flooding removes minima by iteratively increasing their values
Property (contour preservation)
If F is a razing or a flooding of I , then
∀(x , y ) ∈ − →
Γ , F(x) 6= F (y) = ⇒ I (x ) 6= I (y )
Remark. An operator produces razings is not necessarily an opening
(counter-examples: razing by dynamics or volume)
Component tree
Exercise
Draw the image F obtained by razings all components of depth is less than 12
Compare the number of maxima of F and of I
Altitudes
I
E
Component tree