Introduction to mathematical morphology Erosions, Dilations, Openings, Closings
Samy Blusseau, Centre de Morphologie Mathématique November 2020 Mathematical morphology what for?
2 Applications
Screening of diabetic retinopathy
Image credit: Étienne Decencière, Mines ParisTech. 3 Applications
Segmentation of lymphocytes in the blood
Image credit: Étienne Decencière, Mines ParisTech. 4 Applications
Semantization of point clouds
Image credit: Andrés Serna and Beatriz Marcotegui, TERRA3D. 5 Applications
Quality control of industrial materials
Image credit: Copyright Philippe Stroppa, SAFRAN. 6 http://www.safran-medialibrary.com/Medialibrary/media/95545 Applications
7 Principles
An image is an array of numbers, that is to say a function from a discrete grid to real numbers.
Objects usually correspond to ”flat” regions of this function, and are delimited by their contours (extrema of the gradient).
A grayscale image (above) and its morphological gradient (below)
Illustration credit: Jean Serra, Mines ParisTech. 8 Principles
An example of analysis: the Watershed algorithm.
Idea: “flooding” the gradient image, seen as a topographic relief, starting from certain “springs” (for example the regional minima of the gradient.) Illustration credit: Beatriz Marcotegui, Mines ParisTech.
9 The variations of an image are more complex than it may seem! Principles
In red: Maxima of the image (left) and minima of the gradient (right) 10 The variations of an image are more complex than it may seem! Principles
Result of the watershed algorithm: oversegmentation 11 The variations of an image are more complex than it may seem! Principles
Left: result of a morphological filter; Right: the new regional maxima. 12 The variations of an image are more complex than it may seem! Principles
Segmentation after simplification of the image. 13 The variations of an image are more complex than it may seem! Principles
Main idea: simplify images to keep only the relevant information.
Segmentation after simplification of the image. 14 Some examples to get intuitions
15 16 Domain
17 Domain
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 “Dilation of X by the structuring element B”
40 “Dilation of X by the structuring element B”
Property:
41 42 43 44 45 46 47 48 49 50 51 52 53 “Erosion of X by the structuring element B”
Property:
54 “Dilation of X by the structuring element B” “Erosion of X by the structuring element B”
55 Links between and ?
56 57 58 59 60 Here:
61 Here:
(In general: with )
62 Links between and :
Are they inverse of each other?
63 is not injective
64 is not injective
65 is not injective is not surjective
66 is not injective is not surjective
67 is not injective is not surjective
68 is not injective is not surjective
69 is not injective is not surjective
70 is not injective is not surjective
71 72 and are not invertible, however...
73 and are not invertible, however...
74 and are not invertible, however...
75 and are not invertible, however...
76 and are not invertible, however...
Denoting Denoting
Then, on Then, on
77 Quiz time!
78 1. The set X is the dilation of some Y by the structuring element B:
A: True B: False C: I don’t know
79 1. The set X is the dilation of some Y by the structuring element B:
A: True B: False C: I don’t know
2. The set X is the erosion of some Y by the structuring element B:
A: True B: False C: I don’t know
80 3. The dilation of X by the structuring element B is:
A: Y B: Z C: I don’t know
81 Generalization Theory of Complete Lattices
82 Definitions
Partially ordered set
Let be a set. A partial order on is a binary relation that satisfies
Then is called a partially ordered set (or poset).
Examples: , for any set .
83 Definitions
Complete lattice
A complete lattice is a partially ordered set such that any subset of has a supremum and an infimum in .
The supremum and infimum of a subset are respectively noted and .
By antisymmetry of the order, they are unique.
In particular, has a supremum and an infimum, the largest and the smallest elements of the lattice.
84 Definitions
Complete lattice
A complete lattice is a partially ordered set such that any subset of has a supremum and an infimum in .
Example 1: for any set .
For any family of subsets of ,
85 Definitions
Complete lattice
A complete lattice is a partially ordered set such that any subset of has a supremum and an infimum in .
Example 2:
86 Definitions
Complete lattice
A complete lattice is a partially ordered set such that any subset of has a supremum and an infimum in .
Example 2:
87 Definitions
Complete lattice
A complete lattice is a partially ordered set such that any subset of has a supremum and an infimum in .
Example 2:
88 Definitions
Complete lattice
A complete lattice is a partially ordered set such that any subset of has a supremum and an infimum in .
Example 2:
89 Definitions
Complete lattice
A complete lattice is a partially ordered set such that any subset of has a supremum and an infimum in .
Example 2:
90 Definitions
Complete lattice
A complete lattice is a partially ordered set such that any subset of has a supremum and an infimum in .
Example 2:
91 Definitions
Complete lattice
A complete lattice is a partially ordered set such that any subset of has a supremum and an infimum in .
Example 3: where each is a complete lattice and
Then
92 Definitions
Complete lattice
A complete lattice is a partially ordered set such that any subset of has a supremum and an infimum in .
Example 4: For any complete lattice and any set , let be the set of functions from to and the order defined by
Then is a complete lattice and
93 Definitions
Dilation
Let and be two complete lattices.
A dilation from to is an operator that commutes with the supremum:
94 Definitions
Dilation
Let and be two complete lattices.
A dilation from to is an operator that commutes with the supremum:
Properties:
95 Definitions
Dilation
Let and be two complete lattices.
A dilation from to is an operator that commutes with the supremum:
Properties:
(increasingness)
96 Definitions
Dilation
Let and be two complete lattices.
A dilation from to is an operator that commutes with the supremum:
Properties:
(increasingness)
(mapping least element to least element) 97 Definitions
Erosion
Let and be two complete lattices.
An erosion from to is an operator that commutes with the infimum:
Properties:
(increasingness)
(mapping largest element to largest element) 98 Definitions
Opening
Let be a complete lattice.
An opening of is an operator that is
increasing
idempotent
anti-extensive
Important property: the supremum of openings is an opening. Denoting the set of openings of ,
99 Definitions
Closing
Let be a complete lattice.
A closing of is an operator that is
increasing
idempotent
extensive
Important property: the infimum of closings is a closing. Denoting the set of closings of ,
100 Definitions
Adjunction
Let and be two complete lattices, and two operators.
The couple is called and adjunction if and only if
Properties of an adjunction :
(1) is a dilation and is an erosion (4) and (2) (5) is a closing and is an opening.
(3) 101 Definitions
Adjunction
Let and be two complete lattices, and two operators.
The couple is called and adjunction if and only if
Conversely:
If is a dilation then is its unique adjoint erosion.
If is an erosion then is its unique adjoint dilation.
102 Definitions
Adjunction
Let and be two complete lattices, and two operators.
The couple is called and adjunction if and only if
Geometrical interpretation of :
Hence
“Projection” of y on the image of 103 Definitions
Adjunction
Let and be two complete lattices, and two operators.
The couple is called and adjunction if and only if
Geometrical interpretation of :
Hence
“Projection” of x on the image of 104 Example of opening and closing
105 Example of opening
106 Example of closing
107 Definitions
Duality
Let be a complete lattice and an inversion: a bijection such that
If is a dilation on , then is an erosion, called the dual erosion of for . If is an erosion on , then is a dilation, called the dual dilation of for . If is a closing on , then is an opening, called the dual opening of for . If is an opening on , then is a closing, called the dual closing of for .
Example: A particular but very common case is when (involution):
108 Definitions Granulometry
It is a decreasing family of openings , i.e. such that . A granulometry verifies the semi-group property
Granulometries made of openings with increasing structuring elements are typically used to analyse the distribution of bright objects’ sizes in an image.
109 Definitions Anti-granulometry
It is an increasing family of closings , i.e. such that . An anti-granulometry verifies the semi-group property
Anti-granulometries made of closings with increasing structuring elements are typically used to analyse the distribution of dark objects’ sizes in an image.
110 Mathematical morphology on binary images
111 Support of the image Binary image
It is a function from E to {0, 1}, that can be identified to a subset of E.
112 Structuring elements
origin
Symmetrical structuring elements, containing or not the origin. Asymmetrical structuring elements and their symmetric versions
113 Structuring elements
origin
Symmetrical structuring elements, containing or not the origin. Asymmetrical structuring elements and their symmetric versions.
114 Dilation by the structuring element B
115 Dilation by the structuring element B
Minkowski addition
116 117 118 119 120 121 122 123 Dilation by a structuring element B
124 125 126 Erosion by a structuring element B
where
127 128 129 130 Erosion by a structuring element B
131 132 133 Duality and are dual for the set complementation:
Adjunction is an adjunction.
134 Example of opening and closing
135 Example of opening
136 Example of opening and closing
137 Area opening
Connected pixels: In a binary image, two white pixels are said connected if there is a path joining them, included in the set of white pixels. The notion of path depends on the neighbourhood defined by the structuring element.
In each image, are the two marked pixels connected for the considered structuring element? 138 Area opening
Connected pixels: In a binary image, two white pixels are said connected if there is a path joining them, included in the set of white pixels. The notion of path depends on the neighbourhood defined by the structuring element.
139 Area opening
Connected components: They are the equivalence classes induced by the relation “being connected”.
140 Area opening
An area opening with threshold consists in removing connected components with less than pixels. It is indeed an increasing, idempotent and anti-extensive operator.
Results of area openings applied to the previous images. What are the possible threshold values? 141 Area opening
An area opening with threshold consists in removing connected components with less than pixels. It is indeed an increasing, idempotent and anti-extensive operator.
Original
142 Quiz time!
143 4. The set Y is the result of a morphological operator applied to X, using the structuring element B. Is it:
A: The dilation
B: The erosion
C: The opening
D: The closing
E: I don’t know
144 5. The set Y is the result of a morphological operator applied to X, using some structuring element B. Is it:
A: A dilation
B: An erosion
C: An opening
D: A closing
E: I don’t know
145 6. The set Y is the closing of X by some structuring element. This structuring element is:
A: B: C:
D: I don’t know
146 Mathematical morphology on grayscale images
147 Support of the image Grayscale image
It is a function from E to a set a values V. Often, V = {0, 1, …, 255} .
148 Dilation by a flat structuring element B
Flat structuring elements B
where
149 Dilation by a flat structuring element B
Flat structuring elements B
The dilation at each point can also be written as a supremum over a neighbourhood:
150 Erosion by a flat structuring element B
Flat structuring elements B
where
151 Erosion by a flat structuring element B
Flat structuring elements B
The erosion at each point can also be written as an infimum over a neighbourhood:
152 Opening by a flat structuring element B
153 Opening by a flat structuring element B
Regional maxima
154 Opening by a flat structuring element B
Regional minima
155 Closing by a flat structuring element B
156 Closing by a flat structuring element B
Regional maxima
157 Closing by a flat structuring element B
Regional minima
158 Morphological gradient
For a unit, symmetrical structuring element containing the origin, it is the difference between dilation and erosion:
159 Area opening
Upper level sets: The set of pixels with values larger than is called t-upper-level set. The function is a decreasing function, as the family decreases with t.
Original
160 Area opening
Connected components of upper level sets: Each has its own connected components.
Original
161 Area opening
An area opening with threshold consists in assigning to each pixel the largest t such that the area of the pixel’s connected component in is larger than .
It is indeed an increasing, idempotent and anti-extensive operator.
Original
162 Top hat transform
The top hat (resp. dual top hat) is the difference between the image and an opening (resp. a closing and the initial image).
It enhances the elements that are removed by the filter.
In the case of functions, it filters the “low frequencies”.
Illustration credit: Jean Serra, Mines ParisTech. 163 Top hat transform
Example: Extraction of text on an unequal background:
Closing by a Initial image hexagonal SE of Dual top hat size 10 164 Illustration credit: Jean Serra, Mines ParisTech. Conclusion
● Mathematical Morphology is built on two fundamental operators, dilation and erosion
● Based on supremum and infimum in complete lattices, analogous of the sum in vectorial spaces, used in linear signal processing
● Openings and closings are the first morphological filters we studied. When defined by structuring elements, they transform images depending on the shapes of objects.
● Structuring elements also define a neighbourhood relationship. This was used in the area opening, and will be further intensively used in geodesical operators (tomorrow’s course!)
165