SlideShare a Scribd company logo
1 of 186
Image Processing Algorithms
Pt1 – Morphology
Sup Galilée – INFO3/INFOA3
September 2023
John Chaussard
LAGA – Université Sorbonne Paris Nord
chaussard@math.univ-paris13.fr
Image analysis
Goals of image analysis
Image analysis can have various goals:
. Enhance an image for visualization or analysis:
Goals of image analysis
2
Contrast enhancement
Noise removal Blur
compensation
Goals of image analysis
Image analysis can have various goals:
. Detect various elements in an image
Goals of image analysis
3
Plate numbers Face Roads (for autonomous cars)
Goals of image analysis
Image analysis can have various goals:
. Extract an object from an image (segmentation)
Goals of image analysis
4
Cell counting Bronchial tree
extraction
Special effects
Goals of image analysis
Image analysis can have various goals:
. Generate new images from old ones
Goals of image analysis
5
Style transposition Panorama creation
Images
How to represent images in a computer
Definition of an image
7
In the computer, an image is represented as an array, where each cell
contains the value of a pixel of the image.
Mathematically speaking, an image can be seen as an application.
• I is the name of the image
• A is the domain (related to the shape) of the image
• n is the dimension of the image (typically 2)
• B defines which values a pixel of the image can have, an depends on the
kind of image we are dealing with.
An image is an application 𝐼: 𝐴 ⊆ ℤ𝑛
→ 𝐵
Images in computers
Grayscale images
An 8bits grayscale image is an application from a subset of ℤ2
to 0; 255
(to each point of the image corresponds an integer value between 0 and
255).
Each cell of the array / point of the image is called a pixel.
Images in computers
8
176 173 172 174 175 174 175
179 185 187 181 174 173 165
197 181 168 167 171 169 170
161 170 180 183 180 174 175
Extended grayscale images
We can also find, in some applications, 16bits or 32bits grayscale images,
giving more precise infomation on object’s constrast (used in specific
applications such as medical image analysis or astronomical image
analysis).
These images car be represented as application from a subset of ℤ2 into
0; 216
− 1 ou 0; 232
− 1 .
Images in computers
9
210 246 283 281 292
186 231 346 450 417
179 189 312 475 400
Image couleur
Color images are applications from a subset of ℤ2
into 0; 255 3
.
Images in computers
10
51 51 53 54 60 57
15 30 44 53 55 58
23 34 47 61 61 60
65 61 63 68 67 65
89 91 95 99 102 98
53 70 86 95 97 99
61 74 89 101 102 101
100 99 103 107 106 104
73 86 101 113 111 110
113 111 115 116 115 113
127 124 125 117 115 113
124 116 112 116 115 111
Red channel
Green
channel
Blue channel
Images binaires
Binary images are images where the pixels can have only two possibles
values (usually, 0/1 or 0/255).
A binary image can be represented as an application from a subset of ℤ2
into {0;1}, and can also be represented as a subset of ℤ2
, where the pixels
equal to 1 are listed.
Images in computers
11
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
Your turn
Find out what kind of « image » you are dealing with when the image is
defined as:
𝐼: 𝐴 ⊆ ℤ3
→ 0; 255
Images in computers
12
It’s a grayscale 3d image, made of voxels.
These images can be obtained with
specific equipment such as MRI, CT-scans,
or tomographic imagery.
Your turn
Find out what kind of « image » you are dealing with when the image is
defined as:
𝐼: 𝐴 ⊆ ℤ2
× ℤ → 0; 255 3
Images in computers
13
It’s a movie !
Your turn
Find out what kind of « image » you are dealing with when the image is
defined as:
𝐼: 𝐴 ⊆ ℤ2
× ℤ × {0; 1} → 0; 255 3
Images in computers
14
It’s a 3d movie !
An image is a surface…
15
During this class, we will mainly focus on 2d 8bits grayscale images.
Images in computers
However, we will, most of the
time, « see » an image not as an
array of values, but as a
topographic surface, where
bright areas become mountains
and dark areas become canyons.
Why is image analysis
complicated?
Images for a human being
You can easily spot objects in an image because you are familiar with the
object, you learned to recognize many objects since birth.
If you need, however, to spot an object that you are not familiar with, the
detection will be much more difficult for you.
Why is image analysis complicated?
17
You can spot the plane in this image because you
know what is a plane
On this scanner image, where is the stomach?
Images for computers
For a computer (and the programmer), images are only numbers stored in
an array.
When the computer displays a greyscale image, it represents
. Pixels with low values by dark squares.
. Pixels with high values by bright squares.
Why is image analysis complicated?
18
255 255 251 251 251 251 251 251 221
255 247 221 214 214 214 221 243 213
241 216 76 45 44 45 76 213 210
210 182 40 13 29 13 40 182 202
179 67 13 28 116 28 13 67 179
173 42 4 8 29 10 8 45 173
173 42 4 8 34 39 43 70 179
179 67 13 29 145 170 173 182 201
204 182 40 14 36 41 49 98 186
217 214 76 45 45 48 73 192 211
246 246 221 214 214 214 220 245 246
255 255 251 251 251 251 251 251 221
255 247 221 214 214 214 221 243 213
241 216 76 45 44 45 76 213 210
210 182 40 13 29 13 40 182 202
179 67 13 28 116 28 13 67 179
173 42 4 8 29 10 8 45 173
173 42 4 8 34 39 43 70 179
179 67 13 29 145 170 173 182 201
204 182 40 14 36 41 49 98 186
217 214 76 45 45 48 73 192 211
246 246 221 214 214 214 220 245 246
Images for computers
Computer do not have the same undertsanding of an image than a
human being. It does not see shapes naturally, but only numbers in an
array… The understanding of an image can only be brought to the computer
through a program.
Why is image analysis complicated?
19
199 208 206 205 206 209 175 139 145 153 136 112 92 62 64 67 88 106 117 134 145 141 129 155 208 206 205 206 208 203
209 222 218 219 222 194 139 139 153 121 110 109 65 57 92 71 95 134 129 130 140 135 135 131 193 223 218 218 221 213
207 219 215 219 206 146 138 148 118 121 120 73 58 83 121 81 90 134 159 147 140 142 136 128 153 216 217 216 218 210
207 219 216 218 178 144 153 121 127 139 108 102 98 114 144 111 107 138 154 149 147 146 144 137 132 195 222 217 220 211
207 219 217 206 159 160 138 120 142 132 144 141 139 163 176 165 141 142 160 156 134 143 143 141 132 165 220 218 220 211
208 220 218 189 157 158 130 135 145 158 170 161 180 194 194 193 183 165 160 165 151 123 142 145 136 140 207 220 219 210
207 218 213 168 162 150 137 141 151 174 175 184 201 207 204 200 200 194 173 161 164 136 120 154 144 130 185 220 218 210
206 221 196 156 165 140 143 151 163 175 184 205 206 205 203 201 202 203 190 171 160 162 125 147 155 131 152 216 219 210
207 221 171 156 160 138 154 158 169 173 198 203 201 203 203 198 202 202 198 184 166 161 150 141 164 141 130 198 222 210
210 211 153 163 151 144 159 160 163 182 197 198 199 200 202 201 200 198 196 188 173 160 160 146 171 148 128 166 222 210
210 196 151 165 143 154 160 159 173 190 196 199 200 202 202 203 201 200 196 195 187 163 154 154 176 157 135 143 211 211
208 177 149 159 137 162 149 135 152 172 188 199 201 202 201 201 200 196 183 163 158 151 139 154 179 164 136 136 192 212
204 162 146 152 140 165 142 150 150 137 131 152 187 196 197 194 169 130 129 133 162 163 135 136 170 172 143 137 175 210
200 150 147 145 146 152 139 165 142 127 125 132 156 181 195 179 149 115 113 126 152 166 142 120 152 180 150 138 165 203
192 139 146 138 149 134 132 97 73 68 97 128 146 175 195 163 131 117 77 63 71 128 159 131 135 180 153 137 158 200
189 139 143 135 142 135 159 137 130 130 149 162 163 177 193 160 153 164 158 143 145 164 182 151 107 171 160 139 159 194
187 139 137 137 128 140 175 179 176 178 184 185 176 182 195 169 170 186 192 190 190 187 181 156 78 154 167 147 161 191
185 136 133 137 109 134 174 179 189 193 193 186 172 174 189 167 177 194 196 195 189 180 173 145 64 150 165 150 160 190
184 134 132 132 84 122 169 178 189 196 195 184 163 172 192 165 169 196 202 196 188 176 163 131 77 158 161 154 162 192
189 137 128 120 69 109 165 176 186 192 195 183 158 183 204 171 160 187 198 196 186 175 158 120 104 164 158 154 169 195
194 150 127 112 80 106 158 172 180 186 191 181 150 144 167 141 156 184 187 187 178 166 154 113 128 162 150 145 175 196
198 171 128 120 93 117 153 163 171 179 184 182 174 168 167 173 178 184 179 170 167 159 152 131 155 149 136 134 173 196
197 194 135 127 116 115 152 160 166 169 169 180 185 190 193 191 185 173 152 169 174 163 154 151 154 131 124 130 174 194
193 206 164 131 132 112 145 167 171 180 145 140 158 159 155 162 150 131 154 187 181 168 159 151 135 115 124 122 178 190
191 202 186 145 133 108 113 165 172 184 177 147 141 154 156 158 145 159 187 187 179 168 147 128 120 115 120 122 188 189
191 201 192 160 145 115 96 120 166 175 174 174 169 167 173 169 168 176 180 181 175 140 111 115 107 118 110 137 192 187
189 200 195 166 158 105 102 94 115 166 174 176 184 187 186 188 185 177 178 172 142 83 97 110 107 128 107 147 191 183
188 196 189 165 164 118 66 96 102 125 166 182 183 189 194 192 184 178 167 152 124 83 97 108 122 131 122 139 180 181
186 193 180 161 157 141 68 36 91 118 135 168 181 186 187 188 178 165 154 152 130 87 99 121 125 126 139 136 176 181
184 186 170 155 151 149 102 58 85 133 132 139 154 164 168 169 163 152 154 159 139 104 119 130 115 139 149 142 157 176
Here is an image as « seen » by the
computer. Where is the car ?
199 208 206 205 206 209 175 139 145 153 136 112 92 62 64 67 88 106 117 134 145 141 129 155 208 206 205 206 208 203
209 222 218 219 222 194 139 139 153 121 110 109 65 57 92 71 95 134 129 130 140 135 135 131 193 223 218 218 221 213
207 219 215 219 206 146 138 148 118 121 120 73 58 83 121 81 90 134 159 147 140 142 136 128 153 216 217 216 218 210
207 219 216 218 178 144 153 121 127 139 108 102 98 114 144 111 107 138 154 149 147 146 144 137 132 195 222 217 220 211
207 219 217 206 159 160 138 120 142 132 144 141 139 163 176 165 141 142 160 156 134 143 143 141 132 165 220 218 220 211
208 220 218 189 157 158 130 135 145 158 170 161 180 194 194 193 183 165 160 165 151 123 142 145 136 140 207 220 219 210
207 218 213 168 162 150 137 141 151 174 175 184 201 207 204 200 200 194 173 161 164 136 120 154 144 130 185 220 218 210
206 221 196 156 165 140 143 151 163 175 184 205 206 205 203 201 202 203 190 171 160 162 125 147 155 131 152 216 219 210
207 221 171 156 160 138 154 158 169 173 198 203 201 203 203 198 202 202 198 184 166 161 150 141 164 141 130 198 222 210
210 211 153 163 151 144 159 160 163 182 197 198 199 200 202 201 200 198 196 188 173 160 160 146 171 148 128 166 222 210
210 196 151 165 143 154 160 159 173 190 196 199 200 202 202 203 201 200 196 195 187 163 154 154 176 157 135 143 211 211
208 177 149 159 137 162 149 135 152 172 188 199 201 202 201 201 200 196 183 163 158 151 139 154 179 164 136 136 192 212
204 162 146 152 140 165 142 150 150 137 131 152 187 196 197 194 169 130 129 133 162 163 135 136 170 172 143 137 175 210
200 150 147 145 146 152 139 165 142 127 125 132 156 181 195 179 149 115 113 126 152 166 142 120 152 180 150 138 165 203
192 139 146 138 149 134 132 97 73 68 97 128 146 175 195 163 131 117 77 63 71 128 159 131 135 180 153 137 158 200
189 139 143 135 142 135 159 137 130 130 149 162 163 177 193 160 153 164 158 143 145 164 182 151 107 171 160 139 159 194
187 139 137 137 128 140 175 179 176 178 184 185 176 182 195 169 170 186 192 190 190 187 181 156 78 154 167 147 161 191
185 136 133 137 109 134 174 179 189 193 193 186 172 174 189 167 177 194 196 195 189 180 173 145 64 150 165 150 160 190
184 134 132 132 84 122 169 178 189 196 195 184 163 172 192 165 169 196 202 196 188 176 163 131 77 158 161 154 162 192
189 137 128 120 69 109 165 176 186 192 195 183 158 183 204 171 160 187 198 196 186 175 158 120 104 164 158 154 169 195
194 150 127 112 80 106 158 172 180 186 191 181 150 144 167 141 156 184 187 187 178 166 154 113 128 162 150 145 175 196
198 171 128 120 93 117 153 163 171 179 184 182 174 168 167 173 178 184 179 170 167 159 152 131 155 149 136 134 173 196
197 194 135 127 116 115 152 160 166 169 169 180 185 190 193 191 185 173 152 169 174 163 154 151 154 131 124 130 174 194
193 206 164 131 132 112 145 167 171 180 145 140 158 159 155 162 150 131 154 187 181 168 159 151 135 115 124 122 178 190
191 202 186 145 133 108 113 165 172 184 177 147 141 154 156 158 145 159 187 187 179 168 147 128 120 115 120 122 188 189
191 201 192 160 145 115 96 120 166 175 174 174 169 167 173 169 168 176 180 181 175 140 111 115 107 118 110 137 192 187
189 200 195 166 158 105 102 94 115 166 174 176 184 187 186 188 185 177 178 172 142 83 97 110 107 128 107 147 191 183
188 196 189 165 164 118 66 96 102 125 166 182 183 189 194 192 184 178 167 152 124 83 97 108 122 131 122 139 180 181
186 193 180 161 157 141 68 36 91 118 135 168 181 186 187 188 178 165 154 152 130 87 99 121 125 126 139 136 176 181
184 186 170 155 151 149 102 58 85 133 132 139 154 164 168 169 163 152 154 159 139 104 119 130 115 139 149 142 157 176
It’s a trap!
When humans « see » an image like a computer, as
an array of numbers, they lose also the capacity to
understand the image.
Computers have the same problem: they are blind
to colours and shapes naturally. Moreover, they do
not have any knowledge of the context and
content of the image.
Computers are good calculators
This weakness of computers is also their strenght. When presented an image
with few information, they can use (with a good programming) mathematics
in order to build the missing information, thanks to their « number »
interpretation of images.
Why is image analysis complicated?
20
Let’s sum it up
. Humans can easily find objects in an image because they learned, from birth, to
recognize objects, but can do so as long as they already know the objects to find.
. For a computer, images are only numbers stored in an array.
. A computer does not have, naturally, any knowledge on objects to find in an
image: he needs to « learn » this through programming.
Image analysis is a difficult task, consisting in asking the computer to
extract information in an image he does not understand. This can only be
possible with a careful mathematical representation of the object we need to
find or measure in the image.
Why is image analysis complicated?
21
A very brief history of
morphology
Chronology of mathematical morphology
23
Invented by Georges Matheron and Jean Serra in 1964, at l’Ecole des
Mines de Paris.
Was initially developed in order to answer questions relative to mining
operations.
Nowadays, used in many domains of image analysis, such as astronomy,
medical image analysis, …
A brief history of mathematical morphology
Usual steps of image processing
24
A brief history of mathematical morphology
(original image) (enhanced image) (segmented image)
(enhanced segmentation)
(information extraction)
Binary images and
structuring elements
Structuring elements
26
In morphology, most transformations rely on the choice of a structuring
element, which is simply a subset of ℤ𝒏
.
. We will represent a structuring element by an image where the origin will be
outlined in red, elements of the structuring element will have a value of 1, and
others will have a value of 0.
Ex (2d) :
Binary images and structuring elements
E = { (-1,-1), (0, 0), (1,1) }
0 0 1
0 1 0
1 0 0
E = { (-2,-1),(-2, 0),(-1,0),(1,-1),(1,1) }
0 0 0 1 0
1 1 0 0 0
1 0 0 1 0
x
y
origin
Common structuring elements
27
In 2d, there are two important structuring elements: 𝚪𝟒 and 𝚪𝟖.
Binary images and structuring elements
Γ4 = {(-1,0),(1,0),(0,0),(0,1),(0,-1)}
0 1 0
1 1 1
0 1 0
Γ8 = Γ4 U {(-1,-1),(-1,1), (1,1),(1,-1)}
1 1 1
1 1 1
1 1 1
We also have Γ4
∗
= Γ4 (0,0) and Γ8
∗
= Γ8 (0,0) .
Common structuring elements
28
We also have the following structuring elements:
. The disk of radius r as the set of pixels whose center is at a distance less or
equal to r from the origin.
. The line of angle a and length L, as the intersetion of the set of pixels
through which passes the line of angle a passing by the origin, and the disk
of radius L/2.
Binary images and structuring elements
Common structuring elements in 3d
29
We have three important structuring elements in 3d: 𝚪𝟔, 𝚪𝟏𝟖 et 𝚪𝟐𝟔.
Binary images and structuring elements
Γ6 = {(0,0,0),(-1,0,0),(1,0,0),(0,1,0),(0,-1,0),(0,0,1),(0,0,-1)}
Γ18 = Γ6 U { (-1,-1,0), (-1,1,0), (1,-1,0), (1,1,0),
(-1,0,-1), (-1,0,1), (1,0,-1), (1,0,1),
(0,-1,-1), (0,-1,1), (0,1,-1), (0,1,1)}
Γ26 = Γ18 U {(1,1,1), (-1,1,1), (1,-1,1), (1,1,-1),
(-1,-1,1),(-1,1,-1),(1,-1,-1),(-1,-1,-1)}
We also have Γ6
∗
= Γ6 (0,0,0) , Γ18
∗
= Γ18 (0,0,0) and Γ26
∗
= Γ26 (0,0,0) .
Exercise
30
Drawx the structuring element corresponding to this set of points of ℤ2
:
E = {(-2,-1),(-1,-2),(0,-2),(1,-2),(2,-1),(-1,2),(-1,1),(1,2),(1,1)}
Solution :
Binary images and structuring elements
0 1 0 1 0
0 1 0 1 0
0 0 0 0 0
1 0 0 0 1
0 1 1 1 0
Exercise
31
Write the structuring element corresponding to this representation.
Solution : E = {(-2,0),(-2,-1),(-1,0),(-1,-1),(0,2),(0,1),(0,0),(0,-1),(1,1),
(1,0),(1,-1)}
Binary images and structuring elements
0 0 1 0 0
0 0 1 1 0
1 1 1 1 0
1 1 1 1 0
0 0 0 0 0
Translation of a structuring element
32
We define the translation of a structuring element :
Let 𝐸 ⊂ ℤ𝑛
be a structuring element, and let 𝑥 ∈ ℤ𝑛
.
The translation of E by x is 𝐸𝑥 = 𝑣 + 𝑥 𝑣 ∈ 𝐸}.
Binary images and structuring elements
Exercise
33
We set :
. x = (1,1)
. E = {(-2,-1),(-2,0),(-1,0),(0,0),(1,1),(1,0),(1,-1),(2,1),(2,0)}
. Ex = {(-1,0),(-1,1),(0,1),(1,1),(2,2),(2,1),(2,0),(3,2),(3,1)}
Binary images and structuring elements
0 0 0 1 1
1 1 1 1 1
1 0 0 1 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 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
E
x
0 0 0 0 0 0 0
0 0 0 0 0 1 1
0 0 1 1 1 1 1
0 0 1 0 0 1 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
Ex
Morphological erosion
Definition
35
The morphological erosion is a simple local minimum performed on each
pixels of an image:
We set ∀𝑦 ∉ 𝐴, 𝐼 𝑦 = +∞. This makes sense when the structuring element
contains the origin (which is most of the time the case).
Let 𝐼: 𝐴 ⊂ ℤ𝑛
→ 𝐵 (I is an n-dimensional image of domain A and co-
domain B),
and 𝐸 ⊂ ℤ𝑛 be an n-dimensional structuring element.
The erosion of I by E is the transformation, denoted by (𝐼 ⊖ 𝐸),
such that,
∀𝑥 ∈ 𝐴, 𝐼 ⊖ 𝐸 𝑥 = 𝑀𝑖𝑛𝑦∈𝐸𝑥
𝐼(𝑦)
Morphological erosion
58 33 25 25 25 62
17 33 33 80 25 62
11 76 76
11 56 76
52 11 15 15 48 56
52 52 81 15 48 48
58 33 25 25 25 62
17 33 33 80 25 62
11 17 33 76 76 76
11 11 15 65 56 76
52 11 15 15 48 56
52 52 81 15 48 48
Exercise
36
Find the missing values of 𝐼 ⊖ 𝐸
Morphological erosion
1 0 0
1 1 1
0 1 0 E
I
83 143 198 238 25 62
249 58 33 92 80 190
215 17 233 189 117 76
219 11 155 65 95 151
185 119 235 15 140 56
90 52 242 81 87 48 𝐼 ⊖ 𝐸
𝐼
Exercise
37
Find the missing values of 𝐼 ⊖ 𝐸
Morphological erosion
0 1 0
0 0 1
0 0 0 E
I
115 60 94 231 67 164
15 253 244 49 72 154
65 254 122 105 69 183
149 39 42 115 28 25
62 221 5 1 193 231
107 84 182 99 221 76
60
115 60 49 72 67
15 122 105 49 72
39 42 115 28 25
149 5 1 115 28
62 182 5 1 76 231 𝐼 ⊖ 𝐸
If the structuring element does not contain
the origin, then some infinite values could
appear in the erosion result.
60 94 231 67 164 "+∞"
115 60 49 72 67 164
15 122 105 49 72 154
39 42 115 28 25 183
149 5 1 115 28 25
62 182 5 1 76 231
Effect of the erosion on a binary image
38
Morphological erosion
0 0 0 1 1 1 1 1 0 0 0
0 1 1 1 1 1 1 1 1 1 0
0 1 1 1 1 1 1 1 1 1 0
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 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 1
0 1 1 1 1 1 1 1 1 1 0
0 1 1 1 1 1 1 1 1 1 0
0 0 0 1 1 1 1 1 0 0 0
𝐼 𝐸 𝐼 ⊖ 𝐸
Effect of the erosion on a greyscale image
39
Morphological erosion
I 𝐼 ⊖ 𝐸
E
Erosion of I by E erodes the surface of the image : mountains shrink, both in width and
height, and canyons are enlarged.
Morphological dilation
Definition
41
We need to define a new operator for structuring elements
Let 𝐸 ⊂ ℤ𝑛
be a structuring element.
We define 𝐸 = −𝑥 | 𝑥 ∈ 𝐸
Morphological dilation
0 1 0
0 1 1
0 1 1 E
1 1 0
1 1 0
0 1 0 𝐸
Ex : 𝐸 = { 0, −1 , 0,0 , 0,1 , 1, −1 , 1,0 }
𝐸 = { 0,1 , 0,0 , 0, −1 , −1,1 , −1,0 }
The structuring element 𝑬 is the 180° rotation of 𝑬.
Définition
42
The morphological dilation is a simple local maximum performed on each
pixels of an image:
We set ∀𝑦 ∉ 𝐴, 𝐼 𝑦 = −∞. This makes sense when the structuring element
contains the origin (which is most of the time the case).
Let 𝐼: 𝐴 ⊂ ℤ𝑛 → 𝐵 and 𝐸 ⊂ ℤ𝑛.
The dilation of I by E is the transformation, denoted by (𝐼 ⊕ 𝐸),
such that
∀𝑥 ∈ 𝐴, 𝐼 ⊕ 𝐸 𝑥 = 𝑀𝑎𝑥𝑦∈𝐸𝑥
𝐼(𝑦)
Morphological dilation
Exercise
43
Find the missing values of 𝐼 ⊕ 𝐸
Morphological dilation
E
I
199 141 170 59 124 200
134 166 139 229 41 69
39 5 235 196 156 195
107 36 208 157 36 15
98 99 254 43 147 153
66 168 18 183 130 225 𝐼 ⊕ 𝐸
0 1 0 0 0
1 1 0 0 0
1 1 0 0 0
0 0 0 0 0
0 0 0 0 1 𝐸
1 0 0 0 0
0 0 0 0 0
0 0 0 1 1
0 0 0 1 1
0 0 0 1 0
170 235 229 200 200 0
235 235 229 195 195 0
235 254 195 59
254 254 225 229
254 254 183 225 235 196
168 183 183 225 225 157
170 235 229 200 200 0
235 235 229 195 195 0
235 254 199 195 195 59
254 254 183 166 225 229
254 254 183 225 235 196
168 183 183 225 225 157
106 90 81 150 183
205 230 205 231 218
106 200 81 150
205 230 205 231
74 200 81 150 119
128 180 205 219 201
Exercise
44
Find the missing values of 𝐼 ⊕ 𝐸
Morphological dilation
0 0 1
0 0 0
0 0 1
0 0 0
0 0 1 E
I
106 90 8 120 183 56
205 230 24 231 218 229
12 21 81 150 55 185
83 180 205 219 52 106
74 200 55 27 119 52
128 104 131 1 201 48
"-∞" 106 90 81 150 183
"-∞" 205 230 205 231 218
"-∞" 106 200 81 150 183
"-∞" 205 230 205 231 218
"-∞" 74 200 81 150 119
"-∞" 128 180 205 219 201 𝐼 ⊕ 𝐸
If the structuring element does not contain
the origin, then some infinite values could
appear in the dilation result.
𝐸
1 0 0
0 0 0
1 0 0
0 0 0
1 0 0
Efefct of dilation on a binary image
45
Morphological dilation
0 0 0 1 1 1 1 1 0 0 0
0 1 1 1 1 1 1 1 1 1 0
0 1 1 1 1 1 1 1 1 1 0
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 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 1
0 1 1 1 1 1 1 1 1 1 0
0 1 1 1 1 1 1 1 1 1 0
0 0 0 1 1 1 1 1 0 0 0
𝐼 𝐸 𝐼 ⊕ 𝐸
Effect of the dilation on a greyscale image
46
Morphological dilation
I 𝐼 ⊕ 𝐸
E
Dilation of I by E dilates the surface of the image : mountains are enlarged and canyons
are shrunk, both in depth and width.
Morphological gradient
Erosion and dilation
48
Which one is the original image, the erosion, and the dilation ?
Morphological gradient
𝐼 ⊕ 𝐸
𝐼 𝐼 ⊖ 𝐸
Gradient
49
On an image, we can extract objects’ contours with
dilation and erosion.
Morphological gradient
I
𝐼 ⊕ Γ4 − 𝐼 𝐼 − 𝐼 ⊖ Γ4 (𝐼 ⊕ Γ4) − 𝐼 ⊖ Γ4
Definition of gradient
50
Let I be an image et E a structuring element, we define three different
kinds of gradient:
We usually choose 𝜞𝟒 or 𝜞𝟖 to compute a 2d gradient, and 𝜞𝟔, 𝜞𝟏𝟖 or 𝜞𝟐𝟔
to compute a 3d gradient.
Morphological gradient: 𝐺𝐸 𝐼 = 𝐼 ⊕ 𝐸 − 𝐼 ⊖ 𝐸
External gradient: 𝐺𝐸
𝑒𝑥𝑡
𝐼 = 𝐼 ⊕ 𝐸 − 𝐼
Internal gradient: G𝐸
𝑖𝑛𝑡
𝐼 = 𝐼 − (𝐼 ⊖ 𝐸)
Gradient morphologique
Example of gradient result
51
Morphological gradient
I 𝐺𝜞𝟖
𝐼
Why does it work?
52
Morphological gradient
We consider three zones in the image : A, B and C.
Gradient should have high values on C, and low values on A and B.
Why does it work?
53
Morphological gradient
Zone A (pixel x in orange)
208 197 188 215 199
199 199 192 197 204
214 207 203 212 213
199 209 187 185 204
208 207 196 192 206
𝐴 ⊕ 𝛤
8 𝑥 = 212
𝐴 ⊖ 𝛤
8 𝑥 = 185
𝐺𝜞𝟖
𝐴 𝑥 = 27
25 27 27 27 28
29 26 27 27 28
19 27 27 28 29
25 27 27 28 28
25 27 29 21 23
A 𝐺𝜞𝟖
𝐴
Why does it work?
54
Morphological gradient
Zone B (pixel y in orange)
72 87 77 90 92
78 77 87 73 66
81 80 77 80 81
86 71 86 90 88
74 72 86 88 72
𝐵 ⊕ 𝛤
8 𝑦 = 90
𝐵 ⊖ 𝛤
8 𝑦 = 71
𝐺𝜞𝟖
𝐵 𝑦 = 19
25 21 18 26 29
19 15 17 26 28
20 16 19 24 24
20 15 19 18 22
20 18 20 19 20
B 𝐺𝜞𝟖
𝐵
Why does it work?
55
Morphological gradient
Zone C (pixel z in orange)
93 92 77 89 66
79 71 90 89 73
79 209 94 67 79
201 206 199 192 193
188 201 185 198 215
𝐶 ⊕ 𝛤
8 𝑧 = 209
𝐶 ⊖ 𝛤
8 𝑧 = 67
𝐺𝜞𝟖
𝐶 𝑧 = 142
22 22 21 24 27
138 138 142 28 28
138 138 142 132 127
135 130 142 148 148
26 24 24 30 23
C 𝐺𝜞𝟖
𝐶
The role of the structuring element in the gradient
56
Morphological gradient
In case of an image I with
noise, gradient calculated with
a small structuring element
will be affected by the noise.
Gradient calculated with large
structuring element will be
thicker but less affected.
I
𝐺𝜞𝟖
𝐼 𝐺𝑩(𝟏𝟎) 𝐼
Erosion and dilation
properties
Properties of dilation
58
Dilation has some interesting properties:
. Commutativity: 𝐴 ⨁ 𝐵 = 𝐵 ⨁ 𝐴
. Associativity: 𝐴 ⨁ (𝐵 ⨁ 𝐶) = (𝐴 ⨁ 𝐵) ⨁ 𝐶
If we note 𝐵 ⊕ 𝐵 ⊕ ⋯ ⊕ 𝐵 = 𝑛𝐵, then
𝐴 ⊕ 𝐵 ⊕ 𝐵 ⊕ ⋯ ⊕ 𝐵 = 𝐴 ⊕ 𝑛𝐵
Properties of erosion and dilation
If we can precalculate nB (sometimes possible), then, instead of performing n
dilations by B, we perform one dilation by nB.
New structuring elements
59
We can define:
. The size n diamond as 𝑛Γ4
. The size n square as 𝑛Γ8
Properties of erosion and dilation
Erosion does not have these properties
60
Properties of erosion and dilation
0 0 0 0 0 0
0 1 1 1 1 0
0 1 1 1 1 0
0 1 1 1 1 0
0 1 1 1 1 0
0 0 0 0 0 0
0 0 0
1 1 1
0 0 0
0 1 0
0 1 0
0 1 0 0 0 0 0 0 0
0 0 0 0 0 0
0 0 1 1 0 0
0 0 1 1 0 0
0 0 0 0 0 0
0 0 0 0 0 0
A
B
C
𝐴 ⊖ 𝐵 ⊖ 𝐶
𝐵 ⊖ 𝐶 = ∅ therefore 𝐴 ⊖ 𝐵 ⊖ 𝐶 = ℤ2
≠ (𝐴 ⊖ 𝐵) ⊖ 𝐶
𝐵 ⊖ 𝐴 = ∅ therefore 𝐴 ⊖ 𝐵 ≠ 𝐵 ⊖ 𝐴
0 0 0 0 0 0
0 0 1 1 0 0
0 0 1 1 0 0
0 0 1 1 0 0
0 0 1 1 0 0
0 0 0 0 0 0
𝐴 ⊖ 𝐵
Weak decomposability
61
Erosion (as dilation) possesses an interesting property called (weak)
decomposability :
If a structuring element D can be decomposed into smaller struturing
elements B and C through dilation, then instead of performing one erosion
by D, we can perform two successive erosions by B and C.
𝐴 ⊖ 𝐵 ⊕ 𝐶 = 𝐴 ⊖ 𝐵 ⊖ 𝐶
Properties of erosion and dilation
Weak decomposability
62
What is the goal of decomposability?
Let’s imagine: we want to perform an erosion of A by D. However, we
don’t have enough memory to load A into the computer. How can we
compute the erosion of A by D?
Properties of erosion and dilation
0 0 0 0 0 0
0 1 1 1 1 0
0 1 1 1 0 0
0 1 1 1 0 0
0 1 1 1 1 0
0 0 0 0 0 0
A
0 0 0
1 1 1
0 0 0
0 1 0
0 1 0
0 1 0
B C
1 1 1
1 1 1
1 1 1
D
We have 𝐷 = 𝐵 ⊕ 𝐶
Weak decomposability
63
However, thanks to decomposability
𝐴 ⊖ 𝐷 = 𝐴 ⊖ (𝐵 ⊕ 𝐶) = 𝐴 ⊖ 𝐵 ⊖ 𝐶
B is a structuring element that only considers pixels of A located on a same
line. In order to perform an erosion by B, one can load A line by line, and
perform the erosion on each line separately and avoid loading the whole
image A in memory.
We can do the same, after, for the erosion by C by loading column by
column.
Properties of erosion and dilation
0 0 0
1 1 1
0 0 0
0 1 0
0 1 0
0 1 0
B C
1 1 1
1 1 1
1 1 1
D
We first perform an erosion by B, then by C.
Erosion
by C
Erosion
by B
Decomposability
64
Properties of erosion and dilation
0 0 0 0 0 0
0 1 1 1 0 0
0 1 1 1 1 0
0 1 1 1 1 0
0 1 1 1 0 0
0 0 0 0 0 0
A
0 0 0
1 1 1
0 0 0
0 1 0
0 1 0
0 1 0
0 0 0 0 0 0
0 1 1 1 0 0
0 1 1 1 1 0
0 1 1 1 1 0
0 1 1 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
1
1
1
1
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0 0 1 0 0 0
0 0 1 1 0 0
0 0 1 1 0 0
0 0 1 0 0 0
0 0 0 0 0 0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
𝐴 ⊖ B ⊖ 𝐶 = 𝐴 ⊖ 𝐷
0
0
0
0
0
0
Decomposability
65
Dilation also possesses decomposability property (thanks to associativity):
𝐴 ⊕ 𝐵 ⊕ 𝐶 = 𝐴 ⊕ 𝐵 ⊕ 𝐶
Properties of erosion and dilation
Duality
66
Dilation and erosion are dual operators.
If we set 𝐼𝑐
𝑥 = −𝐼(𝑥), then
𝐼 ⊕ 𝐸 𝑥 = 𝐼𝑐 ⊖ 𝐸
𝑐
(𝑥)
Properties of erosion and dilation
Order relation between images
67
We define the following order relation between images:
This is a partial order relation.
We consider two images 𝐼, 𝐽: 𝐴 ⊂ ℤ𝑛 → 𝐵,
𝐼 ≤ 𝐽 ↔ ∀𝑥 ∈ 𝐴, 𝐼 𝑥 ≤ 𝐽(𝑥)
Properties of erosion and dilation
Maximum and minimum
68
We can also define the maximum and minimum of two images:
We consider two images 𝐼, 𝐽: 𝐴 ⊂ ℤ𝑛
→ 𝐵,
∀𝑥 ∈ 𝐴:
𝐼 ∨ 𝐽 𝑥 = 𝑀𝑎𝑥 𝐼 𝑥 , 𝐽 𝑥
𝐼 ∧ 𝐽 𝑥 = 𝑀𝑖𝑛(𝐼 𝑥 , 𝐽 𝑥 )
Properties of erosion and dilation
Monotonicity
69
Dilation and erosion are both increasing operations regarding the image:
Regarding the structuring element, dilation is increasing while erosion is
decreasing:
If 𝐴1 ≤ 𝐴2, then
(𝐴1 ⊕ 𝐸) ≤ (𝐴2 ⊕ 𝐸)
(𝐴1 ⊖ 𝐸) ≤ (𝐴2 ⊖ 𝐸)
Properties of erosion and dilation
If 𝐸1 ⊆ 𝐸2, then
(𝐴 ⊕ 𝐸1) ≤ (𝐴 ⊕ 𝐸2)
(𝐴 ⊖ 𝐸2) ≤ (𝐴 ⊖ 𝐸1)
Extensivity
70
If the structuring element contains the origin, then dilation is extensive and
erosion is anti-extensive (regarding the image).
This means that if the structuring element contains the origin, the gradients
are well defined operations (no negative values possible).
0𝑛 ∈ 𝐸 ⟹
𝐴 ≤ (𝐴 ⊕ 𝐸)
𝐴 ⊖ 𝐸 ≤ 𝐴
Properties of erosion and dilation
Strong decomposability
71
Strong decomposability expresses a decomposability property that can be
used in more cases than weak decomposability.
In order to use strong decomposability, we need to express the structuring
element as the maximum of two (or more) structuring elements, which is
always the case.
Soient 𝐼: 𝐴 ⊂ ℤ𝑛
→ 𝐵 et 𝐸, 𝐹 ⊂ ℤ𝑛
,
𝐼 ⊕ 𝐸 ∨ 𝐹 = 𝐼 ⊕ 𝐸 ∨ 𝐼 ⊕ 𝐹
𝐼 ⊖ 𝐸 ∨ 𝐹 = 𝐼 ⊖ 𝐸 ∧ (𝐼 ⊖ 𝐹)
Properties of erosion and dilation
Case of one pixel structuring element
72
When the structuring element E has only one element, the dilation or erosion
simply performs a translation of the image:
Let 𝐼: 𝐴 ⊂ ℤ𝑛
→ 𝐵 and E = x such that x ∈ ℤ𝑛
.
Then, 𝐼 ⊖ 𝐸 performs a translation of I by the vector -x, and
𝐼 ⊕ 𝐸 performs a translation of I by the vector x.
Properties of erosion and dilation
Morphological opening
Definition
74
The morphological opening is defined as:
Let 𝐼: 𝐴 ⊂ ℤ𝑛 → 𝐵 and 𝐸 ⊆ ℤ𝑛, the opening of I by E is
𝐼 ∘ 𝐸 = 𝐼 ⊖ 𝐸 ⊕ 𝐸
Morphological opening
Exercise
75
Find the missing values
of (𝐼 ⊖ Γ4) and (𝐼 ∘ Γ4)
Morphological opening
I
48 99 29 77 97 27
229 72 37 169 46 146
25 229 1 67 31 108
102 98 228 142 51 221
33 0 104 164 188 10
91 28 229 102 69 237
𝐼 ⊖ Γ4
48 29 29 29 27 27
25 37 1 37 31 27
25 1 1 1 31 31
25 0 31 10
0 0 10 10
28 0 28 69 69 10
48 29 29 29 27 27
25 37 1 37 31 27
25 1 1 1 31 31
25 0 1 51 31 10
0 0 0 102 10 10
28 0 28 69 69 10
48 48 29 37 31 27
48 37 37 37 37 31
25 37 1 51 31 31
25 25 51 31
28 0 102 10
28 28 69 102 69 69
𝐼 ∘ Γ4
48 48 29 37 31 27
48 37 37 37 37 31
25 37 1 51 31 31
25 25 51 102 51 31
28 0 102 102 102 10
28 28 69 102 69 69
Opening of a binary image
76
Morphological opening
𝐼 𝐸 𝐼 ⊖ 𝐸
𝐼 ∘ 𝐸
The opening removes all parts of the object (in white) where the
structuring element cannot fit.
Opening of a greyscale image
77
Morphological opening
I 𝐼 ∘ 𝐸
E
The opening cuts all mountains smaller than the structuring element.
Morphological closing
Definition
79
The morphological closing is defined as:
Let 𝐼: 𝐴 ⊂ ℤ𝑛 → 𝐵 and 𝐸 ⊆ ℤ𝑛, the closing of I by E is
𝐼⦁𝐸 = 𝐼 ⊕ 𝐸 ⊖ 𝐸
Morphological closing
235 242 250 220 249 251
170 220 220 244
170 220 221 244
170 255 220 221 221 155
234 225 221 221 155 155
225 225 225 221 227 155
235 242 250 220 249 251
170 235 220 220 220 244
170 170 220 220 221 244
170 255 220 221 221 155
234 225 221 221 155 155
225 225 225 221 227 155
242 250 250 250 251 251
235 220 249 251
170 221 244 244
255 255 255 221 221 244
234 255 225 221 227 155
234 225 225 227 227 227
242 250 250 250 251 251
235 242 250 220 249 251
170 255 220 221 244 244
255 255 255 221 221 244
234 255 225 221 227 155
234 225 225 227 227 227
Exercise
80
Find the missing values
of (𝐼 ⊕ Γ4) and (𝐼⦁Γ4)
Morphological closing
I
235 242 250 133 249 251
11 186 220 107 49 37
96 170 80 117 72 244
90 255 13 221 41 155
234 177 153 59 51 44
211 150 225 105 227 103
𝐼 ⊕ Γ4
𝐼⦁Γ4
Closing of a binary image
81
Morphological closing
𝐼 𝐸 𝐼 ⊕ 𝐸
𝐼⦁𝐸
The closing removes all parts of the complementary of the object (in
black) where the structuring element cannot fit.
Closing of a greyscale image
82
Morphological closing
I 𝐼⦁𝐸
E
The closing fills all canyons smaller than the structuring element.
Properties of the opening
and closing
Extensiveness
84
Whatever the structuring element we have, opening is anti-extensive and
cloing is extensive.
For all 𝐼 ⊆ ℤ𝑛 and for all 𝐸 ⊆ ℤ𝑛,
𝐼 ∘ 𝐸 ≤ 𝐼 ≤ (𝐼⦁𝐸)
Properties of opening and closing
Monotonicity
85
Opening and closing are both increasing operators regarding the image:
Regarding the structuring element, opening is a decreasing operator and
closing is increasing:
If 𝐴1 ≤ 𝐴2, then
𝐴1 ∘ 𝐸 ≤ (𝐴2 ∘ 𝐸)
𝐴1 ⦁ 𝐸 ≤ (𝐴2 ⦁ 𝐸)
Properties of opening and closing
If 𝐸1 ⊆ 𝐸2, then
𝐴 ∘ 𝐸2 ≤ (𝐴 ∘ 𝐸1)
𝐴 ⦁ 𝐸1 ≤ (𝐴 ⦁ 𝐸2)
Duality
86
Opening and closing are dual operators, meaning:
Prove this property (you should use the definition of the opening/closing,
and the duality principle of the erosion and dilation).
𝐼 ∘ 𝐸 = 𝐼𝐶 ⦁ 𝐸 𝐶
𝐼 ⦁ 𝐸 = 𝐼𝐶 ∘ 𝐸 𝐶
Properties of opening and closing
Idempotency
87
The last, and most interesting property of opeening and closing, is
idempotency :
It is useless to repeat multiple times a same opening or a same closing in a
row on a same image.
For all 𝐼 ⊆ ℤ𝑛
and for all 𝐸 ⊆ ℤ𝑛
,
𝐼 ∘ 𝐸 = 𝐼 ∘ 𝐸 ∘ 𝐸
𝐼 ⦁ 𝐸 = 𝐼 ⦁ 𝐸 ⦁ 𝐸
Properties of opening and closing
Beware of OpenCV
88
There exists two different definitions of dilation…
…leading to two different definition of opening and closing.
Unfortunately, in OpenCV, things got mixed, and the opening and closing
transformations are not well implemented…
…leading to opening and closing which do not always have all the
previously stated properties.
In general, beware when reusing somebody else’s code… you should
trust nobody and test everything!
Properties of opening and closing
Applications : noise
removal, top-hat
Pepper and salt noise removal
90
Opening and closing applications
𝐼
𝐼 ∘ Γ4
(𝐼 ∘ Γ4)⦁2Γ8
This approach works well for
« pepper and salt » noise
Top-hat
91
Problem: extract grains of rice in I
Threshold at 100 can isolate grains of rice on the bottom, but not on the top
part of the image. Threshold at 130 can isolate the top grains correctly, but
not the bottom one.
What is preventing us from finding a satisfying threshold level?
Opening and closing applications
𝐼 Threshold at 100 Threshold at 130
Top-hat
92
Solution : use an opening to remove grains and isolate the background
The Top-Hat operation, which is the difference between an opening and the
original image, allows to remove the background of an image and
compensate any illumination gradient.
Is it well defined or can we have negative values?
Opening and closing applications
𝐼 𝐸 𝐼 ∘ 𝐸 𝐼 − (𝐼 ∘ 𝐸)
Threshold at 50 of 𝐼 − (𝐼 ∘ 𝐸)
Counting objects on an
image
Counting pieces
94
In order to fully understand what the next transformations do, we should see
how to define a « piece » of an object in a binary image.
Connected components
Counting pieces
95
A connected component is the term we will use for the piece of an object.
In a continuous space, the whole notion of connected component is based
on the idea of continuity.
On image A, the red object is made of one connected component, on B, it is
made of two connected components, and on C, it is made of four connected
components.
Connected components
A B C
Counting pieces
96
Question: Of how many connected components is the following object
made?
1 or 2 components? This depends if ce consider that two pixels touching by
a corner are in the same object or not…
Connected components
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 1 1 1 0 0 0 0 0
0 1 1 1 0 0 0 0 0
0 0 0 0 1 1 1 0 0
0 0 0 0 1 1 1 0 0
0 0 0 0 1 1 1 0 0
0 0 0 0 0 1 1 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
Choosing a structuring element
97
In order to count the number of connected components of an object, we
need a structuring element that will define the neighbourhood of a
pixel.
If we choose 𝜞𝟒 as the neighbourhood structuring element, then two pixels
touching by a corner won’t be considered as neighbours.
If we choose 𝜞𝟖 as the neighbourhood structuring element, then two pixels
touching by a corner will be considered as neighbours.
Connected components
Neighbourhood
98
Let 𝐸 ⊂ ℤ𝑛
be a structuring element such that 𝐸 = 𝐸 and E contains the
origin, and let 𝑥, 𝑦 ∈ ℤ𝑛
be two pixels.
There exists some remarkable neighbourhoods, used in most applications:
. The neighbourhood derived from Γ4 and Γ8, called 4-neighbourhood
and 8-neighbourhood,
. The neighbourhood derived from Γ6 and Γ26, called 6-
neighbourhood and 26-neighbourhood,
The pixels x and y are E-neighbours if 𝑦 ∈ 𝐸𝑥 (equivalent to 𝑥 ∈ 𝐸𝑦).
Connected components
Exercise
99
Color in black the 4-neighbourhood of the pixel x (outlined in red):
Connected components
Exercise
100
Color in black the 8-neighbourhood of the pixel x (outlined in red):
Connected components
Exercise
101
Color in black the E-neighbourhood of the pixel x (outlined in red):
Connected components
0 0 1 0 0
0 1 0 1 0
1 1 1 1 1
0 1 0 1 0
0 0 1 0 0
E
Exercise
102
Color in black the F-neighbourhood of the pixel x (outlined in red):
F cannot define a neighbourhood as 𝑭 ≠ 𝑭
Connected components
0 1 1 0 0
0 1 1 0 1
1 0 0 0 1
F
Connected set
103
Let J ⊂ ℤ𝑛
(J is a set of pixels), and 𝐸 ⊂ ℤ𝑛
(E is a structuring element
defining a neighbourhood)
The set J is E-connected if and only if
for all 𝒙, 𝒚 ∈ 𝑱, there exists a sequence (𝑝0, 𝑝1, … , 𝑝𝑘) of elements
of J such that
. 𝑝0 = 𝑥,
. 𝑝𝑘 = 𝑦,
. For all 𝑚 ∈ 1; 𝑘 , 𝑝𝑚−1 and 𝑝m are E-neighbours.
Connected components
Connected component
104
Let I⊂ ℤ𝑛
(I is a set of pixels), and 𝐸 ⊂ ℤ𝑛
(E is a structuring element
defining a neighbourhood).
The set J ⊆ 𝐼 is an E-connected component of I if and only if
. J is E-connected
. J is maximal for this property : there exists no H ⊆ 𝐼 such
that H is E-connected and 𝐽 ⊂ 𝐻
Connected components
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
Exercise
105
Color the E-connected components of I:
Connected components
0 0 0 0 0 0 0 0 0 0 0 0
0 1 1 1 1 0 0 1 1 0 1 0
0 1 1 1 1 1 0 1 1 1 0 0
0 1 1 1 1 1 1 1 1 1 1 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0
1 1 1 1 1
0 0 0 0 0
E
I
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 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
Exercise
106
Color the F-connected components of I:
Connected components
0 0 0 0 0 0 0 0 0 0 0 0
0 1 1 1 1 0 0 1 1 0 1 0
0 1 1 1 1 1 0 1 1 1 0 0
0 1 1 1 1 1 1 1 1 1 1 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 0 0
1 1 1 1 1
0 0 1 0 0
F
I
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
Counting pieces
107
Question: Of how many connected components is the following object
made?
This object is made of two 4-connected components, and one 8-connected
component.
Connected components
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 1 1 1 0 0 0 0 0
0 1 1 1 0 0 0 0 0
0 0 0 0 1 1 1 0 0
0 0 0 0 1 1 1 0 0
0 0 0 0 1 1 1 0 0
0 0 0 0 0 1 1 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
Counting pieces
108
A little word on the 6-connexity in 2d…
Connected components
Inferior reconstruction &
Opening by reconstruction
Definition
110
We now define conditional dilation:
R is called the Reference image
M is called the Mask
Let R, 𝑀: 𝐴 ⊂ ℤ𝑛
→ 𝐵 be two images, and 𝐸 ⊂ ℤ𝑛
be a structuring
element.
The conditional dilation of M by E restricted to R is
𝑀 ⊕𝑅 𝐸 = 𝑀 ⊕ 𝐸 ∧ 𝑅
Inferior reconstruction
Repeating the conditional dilation
111
One can repeat the conditional dilation:
We can define the inferior reconstruction:
Let 𝑅, 𝑀: 𝐴 ⊂ ℤ𝑛
→ 𝐵, and let 𝐸 ⊂ ℤ𝑛
,
(𝑀 ⊕𝑅 𝐸)𝑛= (( 𝑀 ⊕𝑅 𝐸 ⊕𝑅 𝐸) … ⊕𝑅 𝐸) (n times)
Inferior reconstruction
The inferior reconstruction of R by E from M is
𝑅 ∆𝐸 𝑀 = (𝑀 ⊕𝑅 𝐸)∞
(repeat conditional dilation until stability).
Inferior reconstruction
The inferior reconstruction is well defined, as it will converge after a
finite number of steps: it is increasing and has R as an upper bound.
In a discrete space, this is enough for achieving convergence in a finite
number of steps.
There exists 𝑘 ∈ ℕ such that
𝑅 ∆𝐸 𝑀 = (𝑀 ⊕𝑅 𝐸)𝑘
Inferior reconstruction
Effect of the inferior reconstruction on a binary image
113
Inferior reconstruction
𝑀
𝑅
𝑅 ∆Γ8
𝑀
Effect of the inferior reconstruction on a binary image
114
Let R and M be binary images, such that 𝑀 ≤ 𝑅.
(𝑅 ∆𝐸 𝑀) is a binary image containing exactly the E-connected
components of white pixels of R that have at least one pixel white in
M.
Inferior reconstruction
𝑀 𝑅 ∆Γ8
𝑀
𝑅
Grayscale example
115
Inferior reconstruction
R M
Grayscale example
116
Inferior reconstruction
𝑅 ∆Γ8
𝑀
Understanding inferior reconstruction
If M ≤ R, then the result S has
. The same mountains than image M, located at the same place
. The same aspect than image R
Inferior reconstruction
Inferior
Reconstruction
𝑆 = 𝑅 ∆𝐸 𝑀
R
M
E
S
Understanding inferior reconstruction
118
The result of the inferior reconstruction of R by E from M has the same
aspect than R, but only possesses mountains where M has mountains.
Inferior reconstruction
R (three mountains) M (two mountains) R ∆Γ8
M
(two mountains)
Another grayscale example
119
Inferior reconstruction
R M
R ∆Γ4
M
Another grayscale example
120
Inferior reconstruction
R ∆Γ4
𝑀
The result of the inferior
reconstruction does have only one
mountain, located on the same spot
than the mountain of M.
Opening by reconstruction
121
The opening by reconstruction consists in performing first an opening of an
image by a structuring element F, and then reconstruct the original image
from the opening using E:
The structuring element E used for reconstruction is usually Γ4 or Γ8.
The structuring element F used for opening has no constraint, and should be
big enough to remove all undesirable mountains.
Let R ∶ 𝐴 ⊂ ℤ𝑛 → 𝐵, and 𝐸, 𝐹 ⊂ ℤ𝑛,
the opening by reconstruction (under E) of R by F is
𝑅 ∘𝐸 𝐹 = 𝑅 ∆𝐸 𝑅 ∘ 𝐹
Opening by reconstruction
Grayscale example
122
Opening by reconstruction
Opening by reconstruction
I
𝐼 ∘ 𝐵(15)
𝐼 ∘Γ4
𝐵(15)
Application to noise removal
123
Example: We have salt noise on an image
Opening by reconstruction
𝐼𝑚 𝐼𝑚 ∘ 2Γ8 𝐼𝑚 ∘Γ4
2Γ8
Superior reconstruction &
Closing by reconstruction
Definition
125
We now define conditional erosion:
R is called the Reference image
M is called the Mask
Let R, 𝑀: 𝐴 ⊂ ℤ𝑛
→ 𝐵 be two images, and 𝐸 ⊂ ℤ𝑛
be a structuring
element.
The conditional erosion of M by E restricted to R is
𝑀 ⊖𝑅 𝐸 = 𝑀 ⊖ 𝐸 ∨ 𝑅
Superior reconstruction
Repeating the conditional erosion
126
One can repeat the conditional erosion:
We can define the superior reconstruction:
Let 𝑅, 𝑀: 𝐴 ⊂ ℤ𝑛
→ 𝐵, and let 𝐸 ⊂ ℤ𝑛
,
(𝑀 ⊖𝑅 𝐸)𝑛= (( 𝑀 ⊖𝑅 𝐸 ⊖𝑅 𝐸) … ⊖𝑅 𝐸) (n times)
Superior reconstruction
The superior reconstruction of R by E from M is
𝑅 𝛻𝐸 𝑀 = (𝑀 ⊖𝑅 𝐸)∞
(repeat conditional erosion until stability).
Superior reconstruction
The superior reconstruction is well defined, as it will converge after a
finite number of steps: it is decreasing and has R as a lower bound.
In a discrete space, this is enough for achieving convergence in a finite
number of steps.
There exists 𝑘 ∈ ℕ such that
𝑅 𝛻𝐸 𝑀 = (𝑀 ⊖𝑅 𝐸)𝑘
Superior reconstruction
Effect of the superior reconstruction on a binary image
128
Superior reconstruction
𝑀
𝑅
𝑅 𝛻Γ8
𝑀
Effect of the superior reconstruction on a binary image
129
Let R and M be binary images, such that 𝑀 ≥ 𝑅.
(𝑅 𝛻𝐸 𝑀) is a binary image containing exactly the E-connected
components of black pixels of R that have at least one pixel black in
M.
Superior reconstruction
𝑀 𝑅 ∆Γ8
𝑀
𝑅
Grayscale example
130
Superior reconstruction
R M
Grayscale example
131
Superior reconstruction
𝑅 𝛻Γ8
𝑀
Understanding superior reconstruction
If M ≥ R, then the result S has
. The same canyons than image M, located at the same place
. The same aspect than image R
Superior reconstruction
Superior
Reconstruction
𝑆 = 𝑅 𝛻𝐸 𝑀
R
M
E
S
Understanding superior reconstruction
133
The result of the superior reconstruction of R by E from M has the same
aspect than R, but only possesses canyon where M has canyon.
Superior reconstruction
R (two canyons) M (one canyon) R 𝛻Γ8
M
(one canyon)
Another grayscale example
134
R M (the frame is black, no canyon)
𝑅 𝛻Γ4
𝑀
Superior reconstruction
Another grayscale example
135
The result of the superior reconstruction of R from M has the same apsect
than R, and no canyon like M (a hole that is not completely surrounded by
higher ground is not considered to be a canyon… therefore, the holes
touching the border are not canyons).
Superior reconstruction
R M (no cayon) 𝐼 𝛻Γ4
𝑀
(no canyon)
Closing by reconstruction
136
The closing by reconstruction consists in performing first a closing of an
image by a structuring element F, and then reconstruct the original image
from the closing using E:
The structuring element E used for reconstruction is usually Γ4 or Γ8.
The structuring element F used for closing has no constraint, and should be
big enough to remove all undesirable canyons.
Let R: 𝐴 ⊂ ℤ𝑛
→ 𝐵, and 𝐸, 𝐹 ⊂ ℤ𝑛
,
the closing by reconstruction (under E) of R by F is
𝑅 ⦁𝐸 𝐹 = 𝑅 𝛻𝐸 𝑅 ⦁ 𝐹
Closing by reconstruction
Application to noise removal
137
Example: We have pepper noise on an image
Closing by reconstruction
𝐼𝑚 𝐼𝑚 ⦁ 2Γ8 𝐼𝑚 ⦁Γ4
2Γ8
Properties of filters by
reconstruction
Partition
139
We recall the definition of a partition of a set :
Let I be a set, and 𝑃 = {𝑃1, … , 𝑃𝑘} be a set of subsets of I.
We say that P is a partition of I if
∀𝑖, 𝑗 ∈ 1; 𝑘 , 𝑖 ≠ 𝑗 ↔ 𝑃𝑖 ∩ 𝑃𝑗 = ∅
𝑖∈[1;𝑘]
𝑃𝑖 = 𝐼
Properties of filters by reconstruction
Exercise
140
Let E = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
Is {{0,3,7},{2,1,9,8},{4,5},{6,3}} a partition of E ?
No, because 0,3,7 ∪ 6,3 ≠ ∅
Properties of filters by reconstruction
Exercise
141
Let E = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
Is {{1, 8}, {3}, {9, 7, 2}, {5, 6}, {4}} a partition of E ?
No, because 0 does not belong to any element of the partition.
Properties of filters by reconstruction
Exercise
142
Let E = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
Gives a partition of E with four elements at least.
{{2,7,4}, {5,3}, {9,0,1,8}, {6}}
Properties of filters by reconstruction
Relation between partitions
143
There exists a partial order relation between partitions :
Let I be a set, and P1 and P2 be two partitions of I.
We say that P2 is coarser than P1 (and P1 is finer than P2) if each
element of P1 is included in one element of P2.
Properties of filters by reconstruction
𝑃1 : Each color represents one
element of the partition
𝑃2
𝑷𝟐 is coarser than 𝑷𝟏
𝑃3
𝑷𝟏 and 𝑷𝟑 cannot be compared
𝑃4
𝑷𝟏 is coarser than 𝑷𝟒
Relation between partitions
144
A partition 𝑃1 is coarser than a partition 𝑃2 if 𝑃1 can be obtained simply by
merging elements of P2 together.
In other words, the frontiers between the elements of 𝑃1 are included in the
frontiers between the elements of 𝑃2.
Properties of filters by reconstruction
coarser than coarser than
Natural partitioning of an image
145
In a grey level image, an E-flat zone is an E-connected component of
pixels having the same value.
The set of all the E-flat zones of an image represents the natural E-
partitioning of a greyscale image.
Ex : Natural 8-partitioning of image I (each partition has a different color).
Properties of filters by reconstruction
2 3 5 2 3
2 3 5 2 3
2 2 2 1 3
2 1 1 1 3
4 1 1 4 4
I Natural 8-partitioning of I
Connected filter
146
In other words, a connected filter acts on an image by merging together
partitions of the natural partitioning of the image.
Let 𝜓 ∶ A ⊂ ℤ𝑛
→ 𝐵 → 𝐴 → 𝐵 be a filter that takes an image as
input and produces an image as output.
The transformation 𝜓 is E-connected if, for all image 𝐼: 𝐴 → 𝐵, the
natural E-partitioning of 𝜓 𝐼 is coarser than the natural E-
partitioning of I.
Properties of filters by reconstruction
Connected filter
147
All filters by reconstruction are connected filters.
More precisely, a filter by reconstruction where the
reconstruction is performed with a structuring element E, is an E-
connected filter.
Properties of filters by reconstruction
Extensiveness
148
Opening and closing by reconstruction have an extensiveness property: the
larger the structuring element used for the opening or closing, and the
more flat zones of the image will be fusioned.
Properties of filters by reconstruction
Let 𝐼: 𝐴 ⊂ ℤ𝑛 → 𝐵 be an image, and 𝐸, 𝐹1, 𝐹2 ⊂ ℤ𝑛 be structuring
elements, such that 𝐹1 ⊂ 𝐹2.
The natural E-partitioning of (𝑅 ∘𝐸 𝐹2) is coarser than the natural
E-partitioning of (𝑅 ∘𝐸 𝐹1).
The natural E-partitioning of (𝑅 ⦁𝐸 𝐹2) is coarser than the natural
E-partitioning of (𝑅 ⦁𝐸 𝐹1).
Example
149
Properties of filters by reconstruction
𝐼 𝐼 ∘Γ4
12Γ8 𝐼 ∘Γ4
25Γ8 𝐼 ∘Γ4
50Γ8
53218 4-flat zones 39223 4-flat zones 28008 4-flat zones 14034 4-flat zones
Advanced filters: ASF
Definition
151
Alternate Sequential Filter, also called ASF, consists in performing
sequentially openings and closings of an image with a structuring element
whose size increases:
These transformations are very useful in presence of additive and subtractive
noise in the image.
Let 𝐼: 𝐴 ⊂ ℤ𝑛 → 𝐵 and 𝐸 ⊆ ℤ𝑛,
𝐴𝑆𝐹𝑜𝑐
𝑛 𝐼, 𝐸 = ((((((𝐼 ∘ 𝐸) • 𝐸) ∘ 2𝐸) • 2𝐸) … ∘ 𝑛𝐸) • 𝑛𝐸)
𝐴𝑆𝐹𝑐𝑜
𝑛 𝐼, 𝐸 = ((((((𝐼 • 𝐸) ∘ 𝐸) • 2𝐸) ∘ 2𝐸) … • 𝑛𝐸) ∘ 𝑛𝐸)
ASF
Removing noise with ASF
152
Example : remove noise with only ONE opening and ONE closing
ASF
𝐼𝑚 𝐼𝑚 ∘ 2Γ4
(𝐼𝑚 ∘ 2Γ4) • 15Γ4
Removing noise with ASF
153
Example : remove noise with an ASF
ASF
𝐼𝑚 𝐼𝑚 ∘ Γ4
𝐴𝑆𝐹𝑜𝑐
1
𝐼𝑚, Γ4
𝐴𝑆𝐹𝑜𝑐
1 𝐼𝑚, Γ4 ∘ 2Γ4
𝐴𝑆𝐹𝑜𝑐
2 𝐼𝑚, Γ4
𝐴𝑆𝐹𝑜𝑐
2
𝐼𝑚, Γ4 • 11Γ4 (𝐼𝑚 ∘ 2Γ4) • 15Γ4
Connected ASF
154
We can go further with ASF and define connected ASF:
Let 𝐼: 𝐴 ⊂ ℤ𝑛 → 𝐵 and 𝐸 ⊆ ℤ𝑛,
𝐶𝐴𝑆𝐹𝑜𝑐,𝐸
𝑛
𝐼, 𝐹 = ((((( 𝐼 ∘𝐸 𝐹 •𝐸 𝐹) ∘𝐸 2𝐹) •𝐸 2𝐹) … ∘𝐸 𝑛𝐹) •𝐸 𝑛𝐹)
𝐶𝐴𝑆𝐹𝑐𝑜,𝐸
𝑛
𝐼, 𝐹 = ((((( 𝐼 •𝐸 𝐹 ∘𝐸 𝐹) •𝐸 2𝐹) ∘𝐸 2𝐹) … •𝐸 𝑛𝐹) ∘𝐸 𝑛𝐹)
ASF
Connected ASF and noise
155
Example : remove noise with a connected ASF
ASF
𝐼𝑚 𝐶𝐴𝑆𝐹𝑜𝑐,Γ4
2
𝐼𝑚, Γ4
𝐶𝐴𝑆𝐹𝑜𝑐,Γ4
2
𝐼𝑚, Γ4 ∘ 2Γ4 • 4Γ4
𝐴𝑆𝐹𝑜𝑐
2
𝐼𝑚, Γ4 • 11Γ4
Decomposition through CASF
156
When looking at zones modified by the various steps of a connected ASF,
we can see that they modify and merge larger zones of the image, as the
structuring element grows.
ASF
Im
Decomposition through CASF
157
When looking at zones modified by the various steps of a connected ASF,
we can see that they modify and merge larger zones of the image, as the
structuring element grows, creating a scale space decomposition of the
image.
ASF
The red zones show what is modified by
the current step of the ASF compared to
previous step.
𝐶𝐴𝑆𝐹𝑜𝑐,Γ8
𝑛
𝐼𝑚, 𝐵(𝑛)
Advanced filters: H-
maxima and H-minima
h-extrema
159
The goal of h-extrema filters is to remove mountains or canyons based on
their relative height, and not their shape. Unlike all the other morphological
filters we saw, h-extrema filters elements based on their height (colour)
rather than their shape.
For example, how would we do to remove mountains having a height
smaller than 30 in the image beneath?
h-maxima and h-minima
30
𝐼
𝐼-30
𝐼 ∆𝐸 (𝐼 − 30) E
Definition
160
We define h-maxima:
We define h-minima:
Let 𝐼: 𝐴 ⊂ ℤ𝑛
→ 𝐵, 𝐸 ⊂ ℤ𝑛
and ℎ ∈ 𝐵,
h-maxima of I under E is
𝐻𝑀𝐴𝑋ℎ,𝐸 𝐼 = 𝐼 Δ𝐸 (𝐼 − ℎ)
h-maxima and h-minima
Let 𝐼: 𝐴 ⊂ ℤ𝑛 → 𝐵, 𝐸 ⊂ ℤ𝑛 and ℎ ∈ 𝐵,
h-minima of I under E is
𝐻𝑀𝐼𝑁ℎ,𝐸 𝐼 = 𝐼 𝛻𝐸 (𝐼 + ℎ)
Properties
161
The h-maxima removes all mountains whose height is inferior or equal
to h, but also lowers the other mountains by an altitude of h (same for h-
minima with canyons).
h-maxima and h-minima
Local extremum
162
A local maximum (or minimum) is a set of pixels that is not surrounded by
pixels of higher (lower) altitude.
Ex :
h-maxima and h-minima
Local extrema
163
How can we obtain local maximum (minimum) in an image ?
A local maximum is a set of pixels who are sourrounded by pixels of lower
altitude: it is therefore the top of a mountain of altitude at least 1.
A 1-maxima will remove all mountains top of the image, therefore, all the
local maxima.
With a subtraction, we can extract only the mountain tops that we
removed.
h-maxima and h-minima
Local extrema
164
h-maxima and h-minima
𝐼𝑚
𝐻𝑀𝐴𝑋1,𝐸(𝐼𝑚)
E
𝐼𝑚
𝐻𝑀𝐴𝑋1,𝐸(𝐼𝑚)
𝐼𝑚 − 𝐻𝑀𝐴𝑋1,𝐸(𝐼𝑚)
Local extrema
165
We can define the transformation allowing to extract local (or regional)
minima and maxima:
The local minima and maxima transformations produce a binary image, with
pixels being equal to 0 or 1.
Let 𝐼: 𝐴 ⊂ ℤ𝑛 → 𝐵 and 𝐸 ⊂ ℤ𝑛 ,
𝑅𝑀𝐴𝑋𝐸 𝐼 = 𝐼 − 𝐻𝑀𝐴𝑋1,𝐸(𝐼) (local maxima)
𝑅𝑀𝐼𝑁𝐸 𝐼 = 𝐻𝑀𝐼𝑁1,𝐸 𝐼 − 𝐼 (local minima)
h-maxima and h-minima
Application
166
H-maxima and h-minima, combined with local maxima and local minima
can be very efficient to filter objects depending on their relative heights.
Consider the following image, where we want to remove small mountains
(height smaller than 60)
h-maxima and h-minima
Application
167
Consider the following image, where we want to remove small mountains
(height smaller than 60)
h-maxima and h-minima
Mountains to keep
Mountains to
remove
Application
168
These two mountains have the same absolute height, so a threshold won’t
work to isolate the mountains we want to keep…
h-maxima and h-minima
Application
169
Some mountains are large, and some are thin… An opening won’t allow
neither to isolate the good mountains.
h-maxima and h-minima
Application
170
Idea: Apply a 60-maxima in order to remove small mountains…
h-maxima and h-minima
(I-60)
𝐻𝑀𝐴𝑋60,Γ4
𝐼
Notice that the mountains we want to keep didn’t
go under their own base after the subtraction, so
still exist as mountains after h-maxima…
𝐻𝑀𝐴𝑋60,Γ4
𝐼
Application
171
Idea: Then, calculate a regional maxima of the image in order to extract
remaining mountains (the ones higher than 60).
h-maxima and h-minima
𝑅𝑀𝐴𝑋Γ8
(𝐻𝑀𝐴𝑋60,Γ4
𝐼 )
𝑅𝑀𝐴𝑋Γ8
(𝐻𝑀𝐴𝑋60,Γ4
𝐼 )
Application
172
Idea: Finally, reconstruct the original image from these regional maxima,
which are the summit of the mountains we wanted to keep
h-maxima and h-minima
𝐼 ΔΓ8
(𝑅𝑀𝐴𝑋Γ8
𝐻𝑀𝐴𝑋60,Γ4
𝐼 )
The Watershed
transformation
173
Watershed
174
The Watershed is a segmentation algorithm: it allows to find the frontiers
of a particular object in an image.
The gradient allowed to find the frontiers of all the objects in the image.
Here, we want to extract the frontiers of a particular object.
Watershed transformation
Original image Gradient
Marker image
In order to work, the algorithm needs a marker image, where the user will
have identified the location of at least one pixel of the object to extract, and
one pixel of its complement.
The marker image allows to give, to the algorithm, some knowledge about
the object to extract.
Watershed transformation
x
x
One pixels marked
as outside of the
flower
One pixel marked as
inside the flower
175
The gradient image
We finally need a gradient image where the contours of the objects on the
image appear bright. This image can be obtained with a morphological
gradient algorithm.
Watershed transformation
Gradient
176
Flooding
We consider the gradient image to be a piece of land, with its mountains and
canyons.
We place, on this land, some water pumps that will flood the land with
waters of different colour.
Watershed transformation
x
x
We put a pump here
and another one there
177
Flooding
We consider the gradient image to be a piece of land, with its mountains and
canyons.
We place, on this land, some water pumps that will flood the land with
waters of different colour.
Watershed transformation
. When both lakes will meet,
their water won’t mix.
. Two lakes of different colour
will appear and grow little by
little.
178
Flooding
179
Here is the full flooding process illustrated:
Watershed transformation
Results
Once the flooding process is finished, we look at which parts of the map
is under the green lake.
Watershed transformation
These parts correspond to the
pixels belonging to the flower.
180
Summary
181
Watershed transformation
Original image
x
x
Gradient
Markers
Flooding
Detected object
Algorithm
We have:
. I is the gradient image,
. M is the marker image, where the marked pixels of the object are
set to 1, the marked pixels of its complement are set to 2, and the others are
set to 0.
. E is a structuring element
Watershed transformation
182
Algorithm
Initialization:
𝐿 = ∅
𝐹𝑜𝑟 𝑒𝑎𝑐ℎ 𝑝 𝑠𝑢𝑐ℎ 𝑡ℎ𝑎𝑡 𝑀 𝑝 > 0, 𝐿 = 𝐿 ∪ {𝑝}
Main loop:
𝑊ℎ𝑖𝑙𝑒 𝐿 ≠ ∅
𝐶ℎ𝑜𝑜𝑠𝑒 𝑥 ∈ 𝐿 𝑠𝑢𝑐ℎ 𝑡ℎ𝑎𝑡 𝐼 𝑥 ≤ 𝐼 𝑝 𝑓𝑜𝑟 𝑎𝑙𝑙 𝑝 ∈ 𝐿
𝐿 = 𝐿 𝑥
𝐹𝑜𝑟 𝑎𝑙𝑙 𝑦 ∈ 𝐸𝑥 𝑠𝑢𝑐ℎ 𝑡ℎ𝑎𝑡 𝑀 𝑦 = 0
𝑀 𝑦 = 𝑀 𝑥
𝐿 = 𝐿 ∪ {𝑦}
Watershed transformation
183
More than one object
184
We can also detect more than one object in the image by using more than
two sets of markers.
Watershed transformation
Yeast cells
Gradient
x x
x
x
x x x
x
Markers
Result
Conclusion
185
Watershed allows to find the precise frontiers of an object in an image.
The input image must be a gradient image, where objects’ frontiers are
highlighted.
The difficult task consists in finding good markers, automatically if
possible.
Watershed transformation

More Related Content

Similar to Morphologie-cours analyse et traitement d'images.pptx

Just Numbers (14 March 2022).pdf
Just Numbers (14 March 2022).pdfJust Numbers (14 March 2022).pdf
Just Numbers (14 March 2022).pdfFigaroa
 
International global companies in food industry McDonalds and Bur.docx
International global companies in food industry McDonalds  and Bur.docxInternational global companies in food industry McDonalds  and Bur.docx
International global companies in food industry McDonalds and Bur.docxnormanibarber20063
 
Integral image (Summed Area Table)
Integral image (Summed Area Table)Integral image (Summed Area Table)
Integral image (Summed Area Table)Randy Wihandika
 
The future of AI programs in lens design
The future of AI programs in lens designThe future of AI programs in lens design
The future of AI programs in lens designDave Shafer
 
Matemática financeira 6 tabelas financeiras de alto nível - by prof. shibat...
Matemática financeira   6 tabelas financeiras de alto nível - by prof. shibat...Matemática financeira   6 tabelas financeiras de alto nível - by prof. shibat...
Matemática financeira 6 tabelas financeiras de alto nível - by prof. shibat...prof. Renan Viana
 
รายงานระดับบุคคล 1085460018-โรงเรียนอนุบาลระนอง ป.3/2557
รายงานระดับบุคคล 1085460018-โรงเรียนอนุบาลระนอง ป.3/2557รายงานระดับบุคคล 1085460018-โรงเรียนอนุบาลระนอง ป.3/2557
รายงานระดับบุคคล 1085460018-โรงเรียนอนุบาลระนอง ป.3/2557ยุทธกิจ สัตยาวุธ
 
GRE Computer Raw Conversion Table
GRE Computer Raw Conversion TableGRE Computer Raw Conversion Table
GRE Computer Raw Conversion TableSuccess Prep
 
Data Encryption Standard (DES)
Data Encryption Standard (DES)Data Encryption Standard (DES)
Data Encryption Standard (DES)Amir Masinaei
 
People Power1.What is the purpose of the event specifications gu.docx
People Power1.What is the purpose of the event specifications gu.docxPeople Power1.What is the purpose of the event specifications gu.docx
People Power1.What is the purpose of the event specifications gu.docxkarlhennesey
 
Introduction to Data-Oriented Design
Introduction to Data-Oriented DesignIntroduction to Data-Oriented Design
Introduction to Data-Oriented DesignIT Weekend
 
Financial Markets are Graphs
Financial Markets are GraphsFinancial Markets are Graphs
Financial Markets are GraphsNeo4j
 
Horses for Courses: Deep Learning Beyond Niche Applications
Horses for Courses: Deep Learning Beyond Niche ApplicationsHorses for Courses: Deep Learning Beyond Niche Applications
Horses for Courses: Deep Learning Beyond Niche ApplicationsNikita Johnson
 
istatistik tablolar
istatistik tablolaristatistik tablolar
istatistik tablolarBurak Kocak
 

Similar to Morphologie-cours analyse et traitement d'images.pptx (20)

Just Numbers (14 March 2022).pdf
Just Numbers (14 March 2022).pdfJust Numbers (14 March 2022).pdf
Just Numbers (14 March 2022).pdf
 
International global companies in food industry McDonalds and Bur.docx
International global companies in food industry McDonalds  and Bur.docxInternational global companies in food industry McDonalds  and Bur.docx
International global companies in food industry McDonalds and Bur.docx
 
Digital Entrepreneurship
Digital EntrepreneurshipDigital Entrepreneurship
Digital Entrepreneurship
 
Integral image (Summed Area Table)
Integral image (Summed Area Table)Integral image (Summed Area Table)
Integral image (Summed Area Table)
 
The future of AI programs in lens design
The future of AI programs in lens designThe future of AI programs in lens design
The future of AI programs in lens design
 
Bang nhan chia tieu hoc vn
Bang nhan chia tieu hoc vnBang nhan chia tieu hoc vn
Bang nhan chia tieu hoc vn
 
Gabarito inss 2008 (d)
Gabarito inss 2008 (d)Gabarito inss 2008 (d)
Gabarito inss 2008 (d)
 
Gabarito inss 2008 (a)
Gabarito inss 2008 (a)Gabarito inss 2008 (a)
Gabarito inss 2008 (a)
 
Data Encryption Standard
Data Encryption StandardData Encryption Standard
Data Encryption Standard
 
Matemática financeira 6 tabelas financeiras de alto nível - by prof. shibat...
Matemática financeira   6 tabelas financeiras de alto nível - by prof. shibat...Matemática financeira   6 tabelas financeiras de alto nível - by prof. shibat...
Matemática financeira 6 tabelas financeiras de alto nível - by prof. shibat...
 
รายงานระดับบุคคล 1085460018-โรงเรียนอนุบาลระนอง ป.3/2557
รายงานระดับบุคคล 1085460018-โรงเรียนอนุบาลระนอง ป.3/2557รายงานระดับบุคคล 1085460018-โรงเรียนอนุบาลระนอง ป.3/2557
รายงานระดับบุคคล 1085460018-โรงเรียนอนุบาลระนอง ป.3/2557
 
Digital signature
Digital signatureDigital signature
Digital signature
 
talk.ppt
talk.ppttalk.ppt
talk.ppt
 
GRE Computer Raw Conversion Table
GRE Computer Raw Conversion TableGRE Computer Raw Conversion Table
GRE Computer Raw Conversion Table
 
Data Encryption Standard (DES)
Data Encryption Standard (DES)Data Encryption Standard (DES)
Data Encryption Standard (DES)
 
People Power1.What is the purpose of the event specifications gu.docx
People Power1.What is the purpose of the event specifications gu.docxPeople Power1.What is the purpose of the event specifications gu.docx
People Power1.What is the purpose of the event specifications gu.docx
 
Introduction to Data-Oriented Design
Introduction to Data-Oriented DesignIntroduction to Data-Oriented Design
Introduction to Data-Oriented Design
 
Financial Markets are Graphs
Financial Markets are GraphsFinancial Markets are Graphs
Financial Markets are Graphs
 
Horses for Courses: Deep Learning Beyond Niche Applications
Horses for Courses: Deep Learning Beyond Niche ApplicationsHorses for Courses: Deep Learning Beyond Niche Applications
Horses for Courses: Deep Learning Beyond Niche Applications
 
istatistik tablolar
istatistik tablolaristatistik tablolar
istatistik tablolar
 

Recently uploaded

UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 

Recently uploaded (20)

UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 

Morphologie-cours analyse et traitement d'images.pptx

  • 1. Image Processing Algorithms Pt1 – Morphology Sup Galilée – INFO3/INFOA3 September 2023 John Chaussard LAGA – Université Sorbonne Paris Nord chaussard@math.univ-paris13.fr
  • 3. Goals of image analysis Image analysis can have various goals: . Enhance an image for visualization or analysis: Goals of image analysis 2 Contrast enhancement Noise removal Blur compensation
  • 4. Goals of image analysis Image analysis can have various goals: . Detect various elements in an image Goals of image analysis 3 Plate numbers Face Roads (for autonomous cars)
  • 5. Goals of image analysis Image analysis can have various goals: . Extract an object from an image (segmentation) Goals of image analysis 4 Cell counting Bronchial tree extraction Special effects
  • 6. Goals of image analysis Image analysis can have various goals: . Generate new images from old ones Goals of image analysis 5 Style transposition Panorama creation
  • 7. Images How to represent images in a computer
  • 8. Definition of an image 7 In the computer, an image is represented as an array, where each cell contains the value of a pixel of the image. Mathematically speaking, an image can be seen as an application. • I is the name of the image • A is the domain (related to the shape) of the image • n is the dimension of the image (typically 2) • B defines which values a pixel of the image can have, an depends on the kind of image we are dealing with. An image is an application 𝐼: 𝐴 ⊆ ℤ𝑛 → 𝐵 Images in computers
  • 9. Grayscale images An 8bits grayscale image is an application from a subset of ℤ2 to 0; 255 (to each point of the image corresponds an integer value between 0 and 255). Each cell of the array / point of the image is called a pixel. Images in computers 8 176 173 172 174 175 174 175 179 185 187 181 174 173 165 197 181 168 167 171 169 170 161 170 180 183 180 174 175
  • 10. Extended grayscale images We can also find, in some applications, 16bits or 32bits grayscale images, giving more precise infomation on object’s constrast (used in specific applications such as medical image analysis or astronomical image analysis). These images car be represented as application from a subset of ℤ2 into 0; 216 − 1 ou 0; 232 − 1 . Images in computers 9 210 246 283 281 292 186 231 346 450 417 179 189 312 475 400
  • 11. Image couleur Color images are applications from a subset of ℤ2 into 0; 255 3 . Images in computers 10 51 51 53 54 60 57 15 30 44 53 55 58 23 34 47 61 61 60 65 61 63 68 67 65 89 91 95 99 102 98 53 70 86 95 97 99 61 74 89 101 102 101 100 99 103 107 106 104 73 86 101 113 111 110 113 111 115 116 115 113 127 124 125 117 115 113 124 116 112 116 115 111 Red channel Green channel Blue channel
  • 12. Images binaires Binary images are images where the pixels can have only two possibles values (usually, 0/1 or 0/255). A binary image can be represented as an application from a subset of ℤ2 into {0;1}, and can also be represented as a subset of ℤ2 , where the pixels equal to 1 are listed. Images in computers 11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
  • 13. Your turn Find out what kind of « image » you are dealing with when the image is defined as: 𝐼: 𝐴 ⊆ ℤ3 → 0; 255 Images in computers 12 It’s a grayscale 3d image, made of voxels. These images can be obtained with specific equipment such as MRI, CT-scans, or tomographic imagery.
  • 14. Your turn Find out what kind of « image » you are dealing with when the image is defined as: 𝐼: 𝐴 ⊆ ℤ2 × ℤ → 0; 255 3 Images in computers 13 It’s a movie !
  • 15. Your turn Find out what kind of « image » you are dealing with when the image is defined as: 𝐼: 𝐴 ⊆ ℤ2 × ℤ × {0; 1} → 0; 255 3 Images in computers 14 It’s a 3d movie !
  • 16. An image is a surface… 15 During this class, we will mainly focus on 2d 8bits grayscale images. Images in computers However, we will, most of the time, « see » an image not as an array of values, but as a topographic surface, where bright areas become mountains and dark areas become canyons.
  • 17. Why is image analysis complicated?
  • 18. Images for a human being You can easily spot objects in an image because you are familiar with the object, you learned to recognize many objects since birth. If you need, however, to spot an object that you are not familiar with, the detection will be much more difficult for you. Why is image analysis complicated? 17 You can spot the plane in this image because you know what is a plane On this scanner image, where is the stomach?
  • 19. Images for computers For a computer (and the programmer), images are only numbers stored in an array. When the computer displays a greyscale image, it represents . Pixels with low values by dark squares. . Pixels with high values by bright squares. Why is image analysis complicated? 18 255 255 251 251 251 251 251 251 221 255 247 221 214 214 214 221 243 213 241 216 76 45 44 45 76 213 210 210 182 40 13 29 13 40 182 202 179 67 13 28 116 28 13 67 179 173 42 4 8 29 10 8 45 173 173 42 4 8 34 39 43 70 179 179 67 13 29 145 170 173 182 201 204 182 40 14 36 41 49 98 186 217 214 76 45 45 48 73 192 211 246 246 221 214 214 214 220 245 246 255 255 251 251 251 251 251 251 221 255 247 221 214 214 214 221 243 213 241 216 76 45 44 45 76 213 210 210 182 40 13 29 13 40 182 202 179 67 13 28 116 28 13 67 179 173 42 4 8 29 10 8 45 173 173 42 4 8 34 39 43 70 179 179 67 13 29 145 170 173 182 201 204 182 40 14 36 41 49 98 186 217 214 76 45 45 48 73 192 211 246 246 221 214 214 214 220 245 246
  • 20. Images for computers Computer do not have the same undertsanding of an image than a human being. It does not see shapes naturally, but only numbers in an array… The understanding of an image can only be brought to the computer through a program. Why is image analysis complicated? 19 199 208 206 205 206 209 175 139 145 153 136 112 92 62 64 67 88 106 117 134 145 141 129 155 208 206 205 206 208 203 209 222 218 219 222 194 139 139 153 121 110 109 65 57 92 71 95 134 129 130 140 135 135 131 193 223 218 218 221 213 207 219 215 219 206 146 138 148 118 121 120 73 58 83 121 81 90 134 159 147 140 142 136 128 153 216 217 216 218 210 207 219 216 218 178 144 153 121 127 139 108 102 98 114 144 111 107 138 154 149 147 146 144 137 132 195 222 217 220 211 207 219 217 206 159 160 138 120 142 132 144 141 139 163 176 165 141 142 160 156 134 143 143 141 132 165 220 218 220 211 208 220 218 189 157 158 130 135 145 158 170 161 180 194 194 193 183 165 160 165 151 123 142 145 136 140 207 220 219 210 207 218 213 168 162 150 137 141 151 174 175 184 201 207 204 200 200 194 173 161 164 136 120 154 144 130 185 220 218 210 206 221 196 156 165 140 143 151 163 175 184 205 206 205 203 201 202 203 190 171 160 162 125 147 155 131 152 216 219 210 207 221 171 156 160 138 154 158 169 173 198 203 201 203 203 198 202 202 198 184 166 161 150 141 164 141 130 198 222 210 210 211 153 163 151 144 159 160 163 182 197 198 199 200 202 201 200 198 196 188 173 160 160 146 171 148 128 166 222 210 210 196 151 165 143 154 160 159 173 190 196 199 200 202 202 203 201 200 196 195 187 163 154 154 176 157 135 143 211 211 208 177 149 159 137 162 149 135 152 172 188 199 201 202 201 201 200 196 183 163 158 151 139 154 179 164 136 136 192 212 204 162 146 152 140 165 142 150 150 137 131 152 187 196 197 194 169 130 129 133 162 163 135 136 170 172 143 137 175 210 200 150 147 145 146 152 139 165 142 127 125 132 156 181 195 179 149 115 113 126 152 166 142 120 152 180 150 138 165 203 192 139 146 138 149 134 132 97 73 68 97 128 146 175 195 163 131 117 77 63 71 128 159 131 135 180 153 137 158 200 189 139 143 135 142 135 159 137 130 130 149 162 163 177 193 160 153 164 158 143 145 164 182 151 107 171 160 139 159 194 187 139 137 137 128 140 175 179 176 178 184 185 176 182 195 169 170 186 192 190 190 187 181 156 78 154 167 147 161 191 185 136 133 137 109 134 174 179 189 193 193 186 172 174 189 167 177 194 196 195 189 180 173 145 64 150 165 150 160 190 184 134 132 132 84 122 169 178 189 196 195 184 163 172 192 165 169 196 202 196 188 176 163 131 77 158 161 154 162 192 189 137 128 120 69 109 165 176 186 192 195 183 158 183 204 171 160 187 198 196 186 175 158 120 104 164 158 154 169 195 194 150 127 112 80 106 158 172 180 186 191 181 150 144 167 141 156 184 187 187 178 166 154 113 128 162 150 145 175 196 198 171 128 120 93 117 153 163 171 179 184 182 174 168 167 173 178 184 179 170 167 159 152 131 155 149 136 134 173 196 197 194 135 127 116 115 152 160 166 169 169 180 185 190 193 191 185 173 152 169 174 163 154 151 154 131 124 130 174 194 193 206 164 131 132 112 145 167 171 180 145 140 158 159 155 162 150 131 154 187 181 168 159 151 135 115 124 122 178 190 191 202 186 145 133 108 113 165 172 184 177 147 141 154 156 158 145 159 187 187 179 168 147 128 120 115 120 122 188 189 191 201 192 160 145 115 96 120 166 175 174 174 169 167 173 169 168 176 180 181 175 140 111 115 107 118 110 137 192 187 189 200 195 166 158 105 102 94 115 166 174 176 184 187 186 188 185 177 178 172 142 83 97 110 107 128 107 147 191 183 188 196 189 165 164 118 66 96 102 125 166 182 183 189 194 192 184 178 167 152 124 83 97 108 122 131 122 139 180 181 186 193 180 161 157 141 68 36 91 118 135 168 181 186 187 188 178 165 154 152 130 87 99 121 125 126 139 136 176 181 184 186 170 155 151 149 102 58 85 133 132 139 154 164 168 169 163 152 154 159 139 104 119 130 115 139 149 142 157 176 Here is an image as « seen » by the computer. Where is the car ? 199 208 206 205 206 209 175 139 145 153 136 112 92 62 64 67 88 106 117 134 145 141 129 155 208 206 205 206 208 203 209 222 218 219 222 194 139 139 153 121 110 109 65 57 92 71 95 134 129 130 140 135 135 131 193 223 218 218 221 213 207 219 215 219 206 146 138 148 118 121 120 73 58 83 121 81 90 134 159 147 140 142 136 128 153 216 217 216 218 210 207 219 216 218 178 144 153 121 127 139 108 102 98 114 144 111 107 138 154 149 147 146 144 137 132 195 222 217 220 211 207 219 217 206 159 160 138 120 142 132 144 141 139 163 176 165 141 142 160 156 134 143 143 141 132 165 220 218 220 211 208 220 218 189 157 158 130 135 145 158 170 161 180 194 194 193 183 165 160 165 151 123 142 145 136 140 207 220 219 210 207 218 213 168 162 150 137 141 151 174 175 184 201 207 204 200 200 194 173 161 164 136 120 154 144 130 185 220 218 210 206 221 196 156 165 140 143 151 163 175 184 205 206 205 203 201 202 203 190 171 160 162 125 147 155 131 152 216 219 210 207 221 171 156 160 138 154 158 169 173 198 203 201 203 203 198 202 202 198 184 166 161 150 141 164 141 130 198 222 210 210 211 153 163 151 144 159 160 163 182 197 198 199 200 202 201 200 198 196 188 173 160 160 146 171 148 128 166 222 210 210 196 151 165 143 154 160 159 173 190 196 199 200 202 202 203 201 200 196 195 187 163 154 154 176 157 135 143 211 211 208 177 149 159 137 162 149 135 152 172 188 199 201 202 201 201 200 196 183 163 158 151 139 154 179 164 136 136 192 212 204 162 146 152 140 165 142 150 150 137 131 152 187 196 197 194 169 130 129 133 162 163 135 136 170 172 143 137 175 210 200 150 147 145 146 152 139 165 142 127 125 132 156 181 195 179 149 115 113 126 152 166 142 120 152 180 150 138 165 203 192 139 146 138 149 134 132 97 73 68 97 128 146 175 195 163 131 117 77 63 71 128 159 131 135 180 153 137 158 200 189 139 143 135 142 135 159 137 130 130 149 162 163 177 193 160 153 164 158 143 145 164 182 151 107 171 160 139 159 194 187 139 137 137 128 140 175 179 176 178 184 185 176 182 195 169 170 186 192 190 190 187 181 156 78 154 167 147 161 191 185 136 133 137 109 134 174 179 189 193 193 186 172 174 189 167 177 194 196 195 189 180 173 145 64 150 165 150 160 190 184 134 132 132 84 122 169 178 189 196 195 184 163 172 192 165 169 196 202 196 188 176 163 131 77 158 161 154 162 192 189 137 128 120 69 109 165 176 186 192 195 183 158 183 204 171 160 187 198 196 186 175 158 120 104 164 158 154 169 195 194 150 127 112 80 106 158 172 180 186 191 181 150 144 167 141 156 184 187 187 178 166 154 113 128 162 150 145 175 196 198 171 128 120 93 117 153 163 171 179 184 182 174 168 167 173 178 184 179 170 167 159 152 131 155 149 136 134 173 196 197 194 135 127 116 115 152 160 166 169 169 180 185 190 193 191 185 173 152 169 174 163 154 151 154 131 124 130 174 194 193 206 164 131 132 112 145 167 171 180 145 140 158 159 155 162 150 131 154 187 181 168 159 151 135 115 124 122 178 190 191 202 186 145 133 108 113 165 172 184 177 147 141 154 156 158 145 159 187 187 179 168 147 128 120 115 120 122 188 189 191 201 192 160 145 115 96 120 166 175 174 174 169 167 173 169 168 176 180 181 175 140 111 115 107 118 110 137 192 187 189 200 195 166 158 105 102 94 115 166 174 176 184 187 186 188 185 177 178 172 142 83 97 110 107 128 107 147 191 183 188 196 189 165 164 118 66 96 102 125 166 182 183 189 194 192 184 178 167 152 124 83 97 108 122 131 122 139 180 181 186 193 180 161 157 141 68 36 91 118 135 168 181 186 187 188 178 165 154 152 130 87 99 121 125 126 139 136 176 181 184 186 170 155 151 149 102 58 85 133 132 139 154 164 168 169 163 152 154 159 139 104 119 130 115 139 149 142 157 176 It’s a trap! When humans « see » an image like a computer, as an array of numbers, they lose also the capacity to understand the image. Computers have the same problem: they are blind to colours and shapes naturally. Moreover, they do not have any knowledge of the context and content of the image.
  • 21. Computers are good calculators This weakness of computers is also their strenght. When presented an image with few information, they can use (with a good programming) mathematics in order to build the missing information, thanks to their « number » interpretation of images. Why is image analysis complicated? 20
  • 22. Let’s sum it up . Humans can easily find objects in an image because they learned, from birth, to recognize objects, but can do so as long as they already know the objects to find. . For a computer, images are only numbers stored in an array. . A computer does not have, naturally, any knowledge on objects to find in an image: he needs to « learn » this through programming. Image analysis is a difficult task, consisting in asking the computer to extract information in an image he does not understand. This can only be possible with a careful mathematical representation of the object we need to find or measure in the image. Why is image analysis complicated? 21
  • 23. A very brief history of morphology
  • 24. Chronology of mathematical morphology 23 Invented by Georges Matheron and Jean Serra in 1964, at l’Ecole des Mines de Paris. Was initially developed in order to answer questions relative to mining operations. Nowadays, used in many domains of image analysis, such as astronomy, medical image analysis, … A brief history of mathematical morphology
  • 25. Usual steps of image processing 24 A brief history of mathematical morphology (original image) (enhanced image) (segmented image) (enhanced segmentation) (information extraction)
  • 27. Structuring elements 26 In morphology, most transformations rely on the choice of a structuring element, which is simply a subset of ℤ𝒏 . . We will represent a structuring element by an image where the origin will be outlined in red, elements of the structuring element will have a value of 1, and others will have a value of 0. Ex (2d) : Binary images and structuring elements E = { (-1,-1), (0, 0), (1,1) } 0 0 1 0 1 0 1 0 0 E = { (-2,-1),(-2, 0),(-1,0),(1,-1),(1,1) } 0 0 0 1 0 1 1 0 0 0 1 0 0 1 0 x y origin
  • 28. Common structuring elements 27 In 2d, there are two important structuring elements: 𝚪𝟒 and 𝚪𝟖. Binary images and structuring elements Γ4 = {(-1,0),(1,0),(0,0),(0,1),(0,-1)} 0 1 0 1 1 1 0 1 0 Γ8 = Γ4 U {(-1,-1),(-1,1), (1,1),(1,-1)} 1 1 1 1 1 1 1 1 1 We also have Γ4 ∗ = Γ4 (0,0) and Γ8 ∗ = Γ8 (0,0) .
  • 29. Common structuring elements 28 We also have the following structuring elements: . The disk of radius r as the set of pixels whose center is at a distance less or equal to r from the origin. . The line of angle a and length L, as the intersetion of the set of pixels through which passes the line of angle a passing by the origin, and the disk of radius L/2. Binary images and structuring elements
  • 30. Common structuring elements in 3d 29 We have three important structuring elements in 3d: 𝚪𝟔, 𝚪𝟏𝟖 et 𝚪𝟐𝟔. Binary images and structuring elements Γ6 = {(0,0,0),(-1,0,0),(1,0,0),(0,1,0),(0,-1,0),(0,0,1),(0,0,-1)} Γ18 = Γ6 U { (-1,-1,0), (-1,1,0), (1,-1,0), (1,1,0), (-1,0,-1), (-1,0,1), (1,0,-1), (1,0,1), (0,-1,-1), (0,-1,1), (0,1,-1), (0,1,1)} Γ26 = Γ18 U {(1,1,1), (-1,1,1), (1,-1,1), (1,1,-1), (-1,-1,1),(-1,1,-1),(1,-1,-1),(-1,-1,-1)} We also have Γ6 ∗ = Γ6 (0,0,0) , Γ18 ∗ = Γ18 (0,0,0) and Γ26 ∗ = Γ26 (0,0,0) .
  • 31. Exercise 30 Drawx the structuring element corresponding to this set of points of ℤ2 : E = {(-2,-1),(-1,-2),(0,-2),(1,-2),(2,-1),(-1,2),(-1,1),(1,2),(1,1)} Solution : Binary images and structuring elements 0 1 0 1 0 0 1 0 1 0 0 0 0 0 0 1 0 0 0 1 0 1 1 1 0
  • 32. Exercise 31 Write the structuring element corresponding to this representation. Solution : E = {(-2,0),(-2,-1),(-1,0),(-1,-1),(0,2),(0,1),(0,0),(0,-1),(1,1), (1,0),(1,-1)} Binary images and structuring elements 0 0 1 0 0 0 0 1 1 0 1 1 1 1 0 1 1 1 1 0 0 0 0 0 0
  • 33. Translation of a structuring element 32 We define the translation of a structuring element : Let 𝐸 ⊂ ℤ𝑛 be a structuring element, and let 𝑥 ∈ ℤ𝑛 . The translation of E by x is 𝐸𝑥 = 𝑣 + 𝑥 𝑣 ∈ 𝐸}. Binary images and structuring elements
  • 34. Exercise 33 We set : . x = (1,1) . E = {(-2,-1),(-2,0),(-1,0),(0,0),(1,1),(1,0),(1,-1),(2,1),(2,0)} . Ex = {(-1,0),(-1,1),(0,1),(1,1),(2,2),(2,1),(2,0),(3,2),(3,1)} Binary images and structuring elements 0 0 0 1 1 1 1 1 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 E x 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 1 1 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Ex
  • 36. Definition 35 The morphological erosion is a simple local minimum performed on each pixels of an image: We set ∀𝑦 ∉ 𝐴, 𝐼 𝑦 = +∞. This makes sense when the structuring element contains the origin (which is most of the time the case). Let 𝐼: 𝐴 ⊂ ℤ𝑛 → 𝐵 (I is an n-dimensional image of domain A and co- domain B), and 𝐸 ⊂ ℤ𝑛 be an n-dimensional structuring element. The erosion of I by E is the transformation, denoted by (𝐼 ⊖ 𝐸), such that, ∀𝑥 ∈ 𝐴, 𝐼 ⊖ 𝐸 𝑥 = 𝑀𝑖𝑛𝑦∈𝐸𝑥 𝐼(𝑦) Morphological erosion
  • 37. 58 33 25 25 25 62 17 33 33 80 25 62 11 76 76 11 56 76 52 11 15 15 48 56 52 52 81 15 48 48 58 33 25 25 25 62 17 33 33 80 25 62 11 17 33 76 76 76 11 11 15 65 56 76 52 11 15 15 48 56 52 52 81 15 48 48 Exercise 36 Find the missing values of 𝐼 ⊖ 𝐸 Morphological erosion 1 0 0 1 1 1 0 1 0 E I 83 143 198 238 25 62 249 58 33 92 80 190 215 17 233 189 117 76 219 11 155 65 95 151 185 119 235 15 140 56 90 52 242 81 87 48 𝐼 ⊖ 𝐸 𝐼
  • 38. Exercise 37 Find the missing values of 𝐼 ⊖ 𝐸 Morphological erosion 0 1 0 0 0 1 0 0 0 E I 115 60 94 231 67 164 15 253 244 49 72 154 65 254 122 105 69 183 149 39 42 115 28 25 62 221 5 1 193 231 107 84 182 99 221 76 60 115 60 49 72 67 15 122 105 49 72 39 42 115 28 25 149 5 1 115 28 62 182 5 1 76 231 𝐼 ⊖ 𝐸 If the structuring element does not contain the origin, then some infinite values could appear in the erosion result. 60 94 231 67 164 "+∞" 115 60 49 72 67 164 15 122 105 49 72 154 39 42 115 28 25 183 149 5 1 115 28 25 62 182 5 1 76 231
  • 39. Effect of the erosion on a binary image 38 Morphological erosion 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 0 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 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 1 0 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 𝐼 𝐸 𝐼 ⊖ 𝐸
  • 40. Effect of the erosion on a greyscale image 39 Morphological erosion I 𝐼 ⊖ 𝐸 E Erosion of I by E erodes the surface of the image : mountains shrink, both in width and height, and canyons are enlarged.
  • 42. Definition 41 We need to define a new operator for structuring elements Let 𝐸 ⊂ ℤ𝑛 be a structuring element. We define 𝐸 = −𝑥 | 𝑥 ∈ 𝐸 Morphological dilation 0 1 0 0 1 1 0 1 1 E 1 1 0 1 1 0 0 1 0 𝐸 Ex : 𝐸 = { 0, −1 , 0,0 , 0,1 , 1, −1 , 1,0 } 𝐸 = { 0,1 , 0,0 , 0, −1 , −1,1 , −1,0 } The structuring element 𝑬 is the 180° rotation of 𝑬.
  • 43. Définition 42 The morphological dilation is a simple local maximum performed on each pixels of an image: We set ∀𝑦 ∉ 𝐴, 𝐼 𝑦 = −∞. This makes sense when the structuring element contains the origin (which is most of the time the case). Let 𝐼: 𝐴 ⊂ ℤ𝑛 → 𝐵 and 𝐸 ⊂ ℤ𝑛. The dilation of I by E is the transformation, denoted by (𝐼 ⊕ 𝐸), such that ∀𝑥 ∈ 𝐴, 𝐼 ⊕ 𝐸 𝑥 = 𝑀𝑎𝑥𝑦∈𝐸𝑥 𝐼(𝑦) Morphological dilation
  • 44. Exercise 43 Find the missing values of 𝐼 ⊕ 𝐸 Morphological dilation E I 199 141 170 59 124 200 134 166 139 229 41 69 39 5 235 196 156 195 107 36 208 157 36 15 98 99 254 43 147 153 66 168 18 183 130 225 𝐼 ⊕ 𝐸 0 1 0 0 0 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 𝐸 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 1 0 0 0 1 0 170 235 229 200 200 0 235 235 229 195 195 0 235 254 195 59 254 254 225 229 254 254 183 225 235 196 168 183 183 225 225 157 170 235 229 200 200 0 235 235 229 195 195 0 235 254 199 195 195 59 254 254 183 166 225 229 254 254 183 225 235 196 168 183 183 225 225 157
  • 45. 106 90 81 150 183 205 230 205 231 218 106 200 81 150 205 230 205 231 74 200 81 150 119 128 180 205 219 201 Exercise 44 Find the missing values of 𝐼 ⊕ 𝐸 Morphological dilation 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 E I 106 90 8 120 183 56 205 230 24 231 218 229 12 21 81 150 55 185 83 180 205 219 52 106 74 200 55 27 119 52 128 104 131 1 201 48 "-∞" 106 90 81 150 183 "-∞" 205 230 205 231 218 "-∞" 106 200 81 150 183 "-∞" 205 230 205 231 218 "-∞" 74 200 81 150 119 "-∞" 128 180 205 219 201 𝐼 ⊕ 𝐸 If the structuring element does not contain the origin, then some infinite values could appear in the dilation result. 𝐸 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0
  • 46. Efefct of dilation on a binary image 45 Morphological dilation 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 0 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 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 1 0 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 𝐼 𝐸 𝐼 ⊕ 𝐸
  • 47. Effect of the dilation on a greyscale image 46 Morphological dilation I 𝐼 ⊕ 𝐸 E Dilation of I by E dilates the surface of the image : mountains are enlarged and canyons are shrunk, both in depth and width.
  • 49. Erosion and dilation 48 Which one is the original image, the erosion, and the dilation ? Morphological gradient 𝐼 ⊕ 𝐸 𝐼 𝐼 ⊖ 𝐸
  • 50. Gradient 49 On an image, we can extract objects’ contours with dilation and erosion. Morphological gradient I 𝐼 ⊕ Γ4 − 𝐼 𝐼 − 𝐼 ⊖ Γ4 (𝐼 ⊕ Γ4) − 𝐼 ⊖ Γ4
  • 51. Definition of gradient 50 Let I be an image et E a structuring element, we define three different kinds of gradient: We usually choose 𝜞𝟒 or 𝜞𝟖 to compute a 2d gradient, and 𝜞𝟔, 𝜞𝟏𝟖 or 𝜞𝟐𝟔 to compute a 3d gradient. Morphological gradient: 𝐺𝐸 𝐼 = 𝐼 ⊕ 𝐸 − 𝐼 ⊖ 𝐸 External gradient: 𝐺𝐸 𝑒𝑥𝑡 𝐼 = 𝐼 ⊕ 𝐸 − 𝐼 Internal gradient: G𝐸 𝑖𝑛𝑡 𝐼 = 𝐼 − (𝐼 ⊖ 𝐸) Gradient morphologique
  • 52. Example of gradient result 51 Morphological gradient I 𝐺𝜞𝟖 𝐼
  • 53. Why does it work? 52 Morphological gradient We consider three zones in the image : A, B and C. Gradient should have high values on C, and low values on A and B.
  • 54. Why does it work? 53 Morphological gradient Zone A (pixel x in orange) 208 197 188 215 199 199 199 192 197 204 214 207 203 212 213 199 209 187 185 204 208 207 196 192 206 𝐴 ⊕ 𝛤 8 𝑥 = 212 𝐴 ⊖ 𝛤 8 𝑥 = 185 𝐺𝜞𝟖 𝐴 𝑥 = 27 25 27 27 27 28 29 26 27 27 28 19 27 27 28 29 25 27 27 28 28 25 27 29 21 23 A 𝐺𝜞𝟖 𝐴
  • 55. Why does it work? 54 Morphological gradient Zone B (pixel y in orange) 72 87 77 90 92 78 77 87 73 66 81 80 77 80 81 86 71 86 90 88 74 72 86 88 72 𝐵 ⊕ 𝛤 8 𝑦 = 90 𝐵 ⊖ 𝛤 8 𝑦 = 71 𝐺𝜞𝟖 𝐵 𝑦 = 19 25 21 18 26 29 19 15 17 26 28 20 16 19 24 24 20 15 19 18 22 20 18 20 19 20 B 𝐺𝜞𝟖 𝐵
  • 56. Why does it work? 55 Morphological gradient Zone C (pixel z in orange) 93 92 77 89 66 79 71 90 89 73 79 209 94 67 79 201 206 199 192 193 188 201 185 198 215 𝐶 ⊕ 𝛤 8 𝑧 = 209 𝐶 ⊖ 𝛤 8 𝑧 = 67 𝐺𝜞𝟖 𝐶 𝑧 = 142 22 22 21 24 27 138 138 142 28 28 138 138 142 132 127 135 130 142 148 148 26 24 24 30 23 C 𝐺𝜞𝟖 𝐶
  • 57. The role of the structuring element in the gradient 56 Morphological gradient In case of an image I with noise, gradient calculated with a small structuring element will be affected by the noise. Gradient calculated with large structuring element will be thicker but less affected. I 𝐺𝜞𝟖 𝐼 𝐺𝑩(𝟏𝟎) 𝐼
  • 59. Properties of dilation 58 Dilation has some interesting properties: . Commutativity: 𝐴 ⨁ 𝐵 = 𝐵 ⨁ 𝐴 . Associativity: 𝐴 ⨁ (𝐵 ⨁ 𝐶) = (𝐴 ⨁ 𝐵) ⨁ 𝐶 If we note 𝐵 ⊕ 𝐵 ⊕ ⋯ ⊕ 𝐵 = 𝑛𝐵, then 𝐴 ⊕ 𝐵 ⊕ 𝐵 ⊕ ⋯ ⊕ 𝐵 = 𝐴 ⊕ 𝑛𝐵 Properties of erosion and dilation If we can precalculate nB (sometimes possible), then, instead of performing n dilations by B, we perform one dilation by nB.
  • 60. New structuring elements 59 We can define: . The size n diamond as 𝑛Γ4 . The size n square as 𝑛Γ8 Properties of erosion and dilation
  • 61. Erosion does not have these properties 60 Properties of erosion and dilation 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 A B C 𝐴 ⊖ 𝐵 ⊖ 𝐶 𝐵 ⊖ 𝐶 = ∅ therefore 𝐴 ⊖ 𝐵 ⊖ 𝐶 = ℤ2 ≠ (𝐴 ⊖ 𝐵) ⊖ 𝐶 𝐵 ⊖ 𝐴 = ∅ therefore 𝐴 ⊖ 𝐵 ≠ 𝐵 ⊖ 𝐴 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 𝐴 ⊖ 𝐵
  • 62. Weak decomposability 61 Erosion (as dilation) possesses an interesting property called (weak) decomposability : If a structuring element D can be decomposed into smaller struturing elements B and C through dilation, then instead of performing one erosion by D, we can perform two successive erosions by B and C. 𝐴 ⊖ 𝐵 ⊕ 𝐶 = 𝐴 ⊖ 𝐵 ⊖ 𝐶 Properties of erosion and dilation
  • 63. Weak decomposability 62 What is the goal of decomposability? Let’s imagine: we want to perform an erosion of A by D. However, we don’t have enough memory to load A into the computer. How can we compute the erosion of A by D? Properties of erosion and dilation 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 1 0 0 0 0 0 0 0 A 0 0 0 1 1 1 0 0 0 0 1 0 0 1 0 0 1 0 B C 1 1 1 1 1 1 1 1 1 D We have 𝐷 = 𝐵 ⊕ 𝐶
  • 64. Weak decomposability 63 However, thanks to decomposability 𝐴 ⊖ 𝐷 = 𝐴 ⊖ (𝐵 ⊕ 𝐶) = 𝐴 ⊖ 𝐵 ⊖ 𝐶 B is a structuring element that only considers pixels of A located on a same line. In order to perform an erosion by B, one can load A line by line, and perform the erosion on each line separately and avoid loading the whole image A in memory. We can do the same, after, for the erosion by C by loading column by column. Properties of erosion and dilation 0 0 0 1 1 1 0 0 0 0 1 0 0 1 0 0 1 0 B C 1 1 1 1 1 1 1 1 1 D
  • 65. We first perform an erosion by B, then by C. Erosion by C Erosion by B Decomposability 64 Properties of erosion and dilation 0 0 0 0 0 0 0 1 1 1 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 0 0 0 0 0 0 0 0 A 0 0 0 1 1 1 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 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 1 1 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 𝐴 ⊖ B ⊖ 𝐶 = 𝐴 ⊖ 𝐷 0 0 0 0 0 0
  • 66. Decomposability 65 Dilation also possesses decomposability property (thanks to associativity): 𝐴 ⊕ 𝐵 ⊕ 𝐶 = 𝐴 ⊕ 𝐵 ⊕ 𝐶 Properties of erosion and dilation
  • 67. Duality 66 Dilation and erosion are dual operators. If we set 𝐼𝑐 𝑥 = −𝐼(𝑥), then 𝐼 ⊕ 𝐸 𝑥 = 𝐼𝑐 ⊖ 𝐸 𝑐 (𝑥) Properties of erosion and dilation
  • 68. Order relation between images 67 We define the following order relation between images: This is a partial order relation. We consider two images 𝐼, 𝐽: 𝐴 ⊂ ℤ𝑛 → 𝐵, 𝐼 ≤ 𝐽 ↔ ∀𝑥 ∈ 𝐴, 𝐼 𝑥 ≤ 𝐽(𝑥) Properties of erosion and dilation
  • 69. Maximum and minimum 68 We can also define the maximum and minimum of two images: We consider two images 𝐼, 𝐽: 𝐴 ⊂ ℤ𝑛 → 𝐵, ∀𝑥 ∈ 𝐴: 𝐼 ∨ 𝐽 𝑥 = 𝑀𝑎𝑥 𝐼 𝑥 , 𝐽 𝑥 𝐼 ∧ 𝐽 𝑥 = 𝑀𝑖𝑛(𝐼 𝑥 , 𝐽 𝑥 ) Properties of erosion and dilation
  • 70. Monotonicity 69 Dilation and erosion are both increasing operations regarding the image: Regarding the structuring element, dilation is increasing while erosion is decreasing: If 𝐴1 ≤ 𝐴2, then (𝐴1 ⊕ 𝐸) ≤ (𝐴2 ⊕ 𝐸) (𝐴1 ⊖ 𝐸) ≤ (𝐴2 ⊖ 𝐸) Properties of erosion and dilation If 𝐸1 ⊆ 𝐸2, then (𝐴 ⊕ 𝐸1) ≤ (𝐴 ⊕ 𝐸2) (𝐴 ⊖ 𝐸2) ≤ (𝐴 ⊖ 𝐸1)
  • 71. Extensivity 70 If the structuring element contains the origin, then dilation is extensive and erosion is anti-extensive (regarding the image). This means that if the structuring element contains the origin, the gradients are well defined operations (no negative values possible). 0𝑛 ∈ 𝐸 ⟹ 𝐴 ≤ (𝐴 ⊕ 𝐸) 𝐴 ⊖ 𝐸 ≤ 𝐴 Properties of erosion and dilation
  • 72. Strong decomposability 71 Strong decomposability expresses a decomposability property that can be used in more cases than weak decomposability. In order to use strong decomposability, we need to express the structuring element as the maximum of two (or more) structuring elements, which is always the case. Soient 𝐼: 𝐴 ⊂ ℤ𝑛 → 𝐵 et 𝐸, 𝐹 ⊂ ℤ𝑛 , 𝐼 ⊕ 𝐸 ∨ 𝐹 = 𝐼 ⊕ 𝐸 ∨ 𝐼 ⊕ 𝐹 𝐼 ⊖ 𝐸 ∨ 𝐹 = 𝐼 ⊖ 𝐸 ∧ (𝐼 ⊖ 𝐹) Properties of erosion and dilation
  • 73. Case of one pixel structuring element 72 When the structuring element E has only one element, the dilation or erosion simply performs a translation of the image: Let 𝐼: 𝐴 ⊂ ℤ𝑛 → 𝐵 and E = x such that x ∈ ℤ𝑛 . Then, 𝐼 ⊖ 𝐸 performs a translation of I by the vector -x, and 𝐼 ⊕ 𝐸 performs a translation of I by the vector x. Properties of erosion and dilation
  • 75. Definition 74 The morphological opening is defined as: Let 𝐼: 𝐴 ⊂ ℤ𝑛 → 𝐵 and 𝐸 ⊆ ℤ𝑛, the opening of I by E is 𝐼 ∘ 𝐸 = 𝐼 ⊖ 𝐸 ⊕ 𝐸 Morphological opening
  • 76. Exercise 75 Find the missing values of (𝐼 ⊖ Γ4) and (𝐼 ∘ Γ4) Morphological opening I 48 99 29 77 97 27 229 72 37 169 46 146 25 229 1 67 31 108 102 98 228 142 51 221 33 0 104 164 188 10 91 28 229 102 69 237 𝐼 ⊖ Γ4 48 29 29 29 27 27 25 37 1 37 31 27 25 1 1 1 31 31 25 0 31 10 0 0 10 10 28 0 28 69 69 10 48 29 29 29 27 27 25 37 1 37 31 27 25 1 1 1 31 31 25 0 1 51 31 10 0 0 0 102 10 10 28 0 28 69 69 10 48 48 29 37 31 27 48 37 37 37 37 31 25 37 1 51 31 31 25 25 51 31 28 0 102 10 28 28 69 102 69 69 𝐼 ∘ Γ4 48 48 29 37 31 27 48 37 37 37 37 31 25 37 1 51 31 31 25 25 51 102 51 31 28 0 102 102 102 10 28 28 69 102 69 69
  • 77. Opening of a binary image 76 Morphological opening 𝐼 𝐸 𝐼 ⊖ 𝐸 𝐼 ∘ 𝐸 The opening removes all parts of the object (in white) where the structuring element cannot fit.
  • 78. Opening of a greyscale image 77 Morphological opening I 𝐼 ∘ 𝐸 E The opening cuts all mountains smaller than the structuring element.
  • 80. Definition 79 The morphological closing is defined as: Let 𝐼: 𝐴 ⊂ ℤ𝑛 → 𝐵 and 𝐸 ⊆ ℤ𝑛, the closing of I by E is 𝐼⦁𝐸 = 𝐼 ⊕ 𝐸 ⊖ 𝐸 Morphological closing
  • 81. 235 242 250 220 249 251 170 220 220 244 170 220 221 244 170 255 220 221 221 155 234 225 221 221 155 155 225 225 225 221 227 155 235 242 250 220 249 251 170 235 220 220 220 244 170 170 220 220 221 244 170 255 220 221 221 155 234 225 221 221 155 155 225 225 225 221 227 155 242 250 250 250 251 251 235 220 249 251 170 221 244 244 255 255 255 221 221 244 234 255 225 221 227 155 234 225 225 227 227 227 242 250 250 250 251 251 235 242 250 220 249 251 170 255 220 221 244 244 255 255 255 221 221 244 234 255 225 221 227 155 234 225 225 227 227 227 Exercise 80 Find the missing values of (𝐼 ⊕ Γ4) and (𝐼⦁Γ4) Morphological closing I 235 242 250 133 249 251 11 186 220 107 49 37 96 170 80 117 72 244 90 255 13 221 41 155 234 177 153 59 51 44 211 150 225 105 227 103 𝐼 ⊕ Γ4 𝐼⦁Γ4
  • 82. Closing of a binary image 81 Morphological closing 𝐼 𝐸 𝐼 ⊕ 𝐸 𝐼⦁𝐸 The closing removes all parts of the complementary of the object (in black) where the structuring element cannot fit.
  • 83. Closing of a greyscale image 82 Morphological closing I 𝐼⦁𝐸 E The closing fills all canyons smaller than the structuring element.
  • 84. Properties of the opening and closing
  • 85. Extensiveness 84 Whatever the structuring element we have, opening is anti-extensive and cloing is extensive. For all 𝐼 ⊆ ℤ𝑛 and for all 𝐸 ⊆ ℤ𝑛, 𝐼 ∘ 𝐸 ≤ 𝐼 ≤ (𝐼⦁𝐸) Properties of opening and closing
  • 86. Monotonicity 85 Opening and closing are both increasing operators regarding the image: Regarding the structuring element, opening is a decreasing operator and closing is increasing: If 𝐴1 ≤ 𝐴2, then 𝐴1 ∘ 𝐸 ≤ (𝐴2 ∘ 𝐸) 𝐴1 ⦁ 𝐸 ≤ (𝐴2 ⦁ 𝐸) Properties of opening and closing If 𝐸1 ⊆ 𝐸2, then 𝐴 ∘ 𝐸2 ≤ (𝐴 ∘ 𝐸1) 𝐴 ⦁ 𝐸1 ≤ (𝐴 ⦁ 𝐸2)
  • 87. Duality 86 Opening and closing are dual operators, meaning: Prove this property (you should use the definition of the opening/closing, and the duality principle of the erosion and dilation). 𝐼 ∘ 𝐸 = 𝐼𝐶 ⦁ 𝐸 𝐶 𝐼 ⦁ 𝐸 = 𝐼𝐶 ∘ 𝐸 𝐶 Properties of opening and closing
  • 88. Idempotency 87 The last, and most interesting property of opeening and closing, is idempotency : It is useless to repeat multiple times a same opening or a same closing in a row on a same image. For all 𝐼 ⊆ ℤ𝑛 and for all 𝐸 ⊆ ℤ𝑛 , 𝐼 ∘ 𝐸 = 𝐼 ∘ 𝐸 ∘ 𝐸 𝐼 ⦁ 𝐸 = 𝐼 ⦁ 𝐸 ⦁ 𝐸 Properties of opening and closing
  • 89. Beware of OpenCV 88 There exists two different definitions of dilation… …leading to two different definition of opening and closing. Unfortunately, in OpenCV, things got mixed, and the opening and closing transformations are not well implemented… …leading to opening and closing which do not always have all the previously stated properties. In general, beware when reusing somebody else’s code… you should trust nobody and test everything! Properties of opening and closing
  • 91. Pepper and salt noise removal 90 Opening and closing applications 𝐼 𝐼 ∘ Γ4 (𝐼 ∘ Γ4)⦁2Γ8 This approach works well for « pepper and salt » noise
  • 92. Top-hat 91 Problem: extract grains of rice in I Threshold at 100 can isolate grains of rice on the bottom, but not on the top part of the image. Threshold at 130 can isolate the top grains correctly, but not the bottom one. What is preventing us from finding a satisfying threshold level? Opening and closing applications 𝐼 Threshold at 100 Threshold at 130
  • 93. Top-hat 92 Solution : use an opening to remove grains and isolate the background The Top-Hat operation, which is the difference between an opening and the original image, allows to remove the background of an image and compensate any illumination gradient. Is it well defined or can we have negative values? Opening and closing applications 𝐼 𝐸 𝐼 ∘ 𝐸 𝐼 − (𝐼 ∘ 𝐸) Threshold at 50 of 𝐼 − (𝐼 ∘ 𝐸)
  • 95. Counting pieces 94 In order to fully understand what the next transformations do, we should see how to define a « piece » of an object in a binary image. Connected components
  • 96. Counting pieces 95 A connected component is the term we will use for the piece of an object. In a continuous space, the whole notion of connected component is based on the idea of continuity. On image A, the red object is made of one connected component, on B, it is made of two connected components, and on C, it is made of four connected components. Connected components A B C
  • 97. Counting pieces 96 Question: Of how many connected components is the following object made? 1 or 2 components? This depends if ce consider that two pixels touching by a corner are in the same object or not… Connected components 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  • 98. Choosing a structuring element 97 In order to count the number of connected components of an object, we need a structuring element that will define the neighbourhood of a pixel. If we choose 𝜞𝟒 as the neighbourhood structuring element, then two pixels touching by a corner won’t be considered as neighbours. If we choose 𝜞𝟖 as the neighbourhood structuring element, then two pixels touching by a corner will be considered as neighbours. Connected components
  • 99. Neighbourhood 98 Let 𝐸 ⊂ ℤ𝑛 be a structuring element such that 𝐸 = 𝐸 and E contains the origin, and let 𝑥, 𝑦 ∈ ℤ𝑛 be two pixels. There exists some remarkable neighbourhoods, used in most applications: . The neighbourhood derived from Γ4 and Γ8, called 4-neighbourhood and 8-neighbourhood, . The neighbourhood derived from Γ6 and Γ26, called 6- neighbourhood and 26-neighbourhood, The pixels x and y are E-neighbours if 𝑦 ∈ 𝐸𝑥 (equivalent to 𝑥 ∈ 𝐸𝑦). Connected components
  • 100. Exercise 99 Color in black the 4-neighbourhood of the pixel x (outlined in red): Connected components
  • 101. Exercise 100 Color in black the 8-neighbourhood of the pixel x (outlined in red): Connected components
  • 102. Exercise 101 Color in black the E-neighbourhood of the pixel x (outlined in red): Connected components 0 0 1 0 0 0 1 0 1 0 1 1 1 1 1 0 1 0 1 0 0 0 1 0 0 E
  • 103. Exercise 102 Color in black the F-neighbourhood of the pixel x (outlined in red): F cannot define a neighbourhood as 𝑭 ≠ 𝑭 Connected components 0 1 1 0 0 0 1 1 0 1 1 0 0 0 1 F
  • 104. Connected set 103 Let J ⊂ ℤ𝑛 (J is a set of pixels), and 𝐸 ⊂ ℤ𝑛 (E is a structuring element defining a neighbourhood) The set J is E-connected if and only if for all 𝒙, 𝒚 ∈ 𝑱, there exists a sequence (𝑝0, 𝑝1, … , 𝑝𝑘) of elements of J such that . 𝑝0 = 𝑥, . 𝑝𝑘 = 𝑦, . For all 𝑚 ∈ 1; 𝑘 , 𝑝𝑚−1 and 𝑝m are E-neighbours. Connected components
  • 105. Connected component 104 Let I⊂ ℤ𝑛 (I is a set of pixels), and 𝐸 ⊂ ℤ𝑛 (E is a structuring element defining a neighbourhood). The set J ⊆ 𝐼 is an E-connected component of I if and only if . J is E-connected . J is maximal for this property : there exists no H ⊆ 𝐼 such that H is E-connected and 𝐽 ⊂ 𝐻 Connected components
  • 106. 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 Exercise 105 Color the E-connected components of I: Connected components 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 0 1 0 0 1 1 1 1 1 0 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 E I 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
  • 107. 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 Exercise 106 Color the F-connected components of I: Connected components 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 0 1 0 0 1 1 1 1 1 0 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 1 1 1 0 0 1 0 0 F I 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
  • 108. Counting pieces 107 Question: Of how many connected components is the following object made? This object is made of two 4-connected components, and one 8-connected component. Connected components 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  • 109. Counting pieces 108 A little word on the 6-connexity in 2d… Connected components
  • 110. Inferior reconstruction & Opening by reconstruction
  • 111. Definition 110 We now define conditional dilation: R is called the Reference image M is called the Mask Let R, 𝑀: 𝐴 ⊂ ℤ𝑛 → 𝐵 be two images, and 𝐸 ⊂ ℤ𝑛 be a structuring element. The conditional dilation of M by E restricted to R is 𝑀 ⊕𝑅 𝐸 = 𝑀 ⊕ 𝐸 ∧ 𝑅 Inferior reconstruction
  • 112. Repeating the conditional dilation 111 One can repeat the conditional dilation: We can define the inferior reconstruction: Let 𝑅, 𝑀: 𝐴 ⊂ ℤ𝑛 → 𝐵, and let 𝐸 ⊂ ℤ𝑛 , (𝑀 ⊕𝑅 𝐸)𝑛= (( 𝑀 ⊕𝑅 𝐸 ⊕𝑅 𝐸) … ⊕𝑅 𝐸) (n times) Inferior reconstruction The inferior reconstruction of R by E from M is 𝑅 ∆𝐸 𝑀 = (𝑀 ⊕𝑅 𝐸)∞ (repeat conditional dilation until stability).
  • 113. Inferior reconstruction The inferior reconstruction is well defined, as it will converge after a finite number of steps: it is increasing and has R as an upper bound. In a discrete space, this is enough for achieving convergence in a finite number of steps. There exists 𝑘 ∈ ℕ such that 𝑅 ∆𝐸 𝑀 = (𝑀 ⊕𝑅 𝐸)𝑘 Inferior reconstruction
  • 114. Effect of the inferior reconstruction on a binary image 113 Inferior reconstruction 𝑀 𝑅 𝑅 ∆Γ8 𝑀
  • 115. Effect of the inferior reconstruction on a binary image 114 Let R and M be binary images, such that 𝑀 ≤ 𝑅. (𝑅 ∆𝐸 𝑀) is a binary image containing exactly the E-connected components of white pixels of R that have at least one pixel white in M. Inferior reconstruction 𝑀 𝑅 ∆Γ8 𝑀 𝑅
  • 118. Understanding inferior reconstruction If M ≤ R, then the result S has . The same mountains than image M, located at the same place . The same aspect than image R Inferior reconstruction Inferior Reconstruction 𝑆 = 𝑅 ∆𝐸 𝑀 R M E S
  • 119. Understanding inferior reconstruction 118 The result of the inferior reconstruction of R by E from M has the same aspect than R, but only possesses mountains where M has mountains. Inferior reconstruction R (three mountains) M (two mountains) R ∆Γ8 M (two mountains)
  • 120. Another grayscale example 119 Inferior reconstruction R M R ∆Γ4 M
  • 121. Another grayscale example 120 Inferior reconstruction R ∆Γ4 𝑀 The result of the inferior reconstruction does have only one mountain, located on the same spot than the mountain of M.
  • 122. Opening by reconstruction 121 The opening by reconstruction consists in performing first an opening of an image by a structuring element F, and then reconstruct the original image from the opening using E: The structuring element E used for reconstruction is usually Γ4 or Γ8. The structuring element F used for opening has no constraint, and should be big enough to remove all undesirable mountains. Let R ∶ 𝐴 ⊂ ℤ𝑛 → 𝐵, and 𝐸, 𝐹 ⊂ ℤ𝑛, the opening by reconstruction (under E) of R by F is 𝑅 ∘𝐸 𝐹 = 𝑅 ∆𝐸 𝑅 ∘ 𝐹 Opening by reconstruction
  • 123. Grayscale example 122 Opening by reconstruction Opening by reconstruction I 𝐼 ∘ 𝐵(15) 𝐼 ∘Γ4 𝐵(15)
  • 124. Application to noise removal 123 Example: We have salt noise on an image Opening by reconstruction 𝐼𝑚 𝐼𝑚 ∘ 2Γ8 𝐼𝑚 ∘Γ4 2Γ8
  • 125. Superior reconstruction & Closing by reconstruction
  • 126. Definition 125 We now define conditional erosion: R is called the Reference image M is called the Mask Let R, 𝑀: 𝐴 ⊂ ℤ𝑛 → 𝐵 be two images, and 𝐸 ⊂ ℤ𝑛 be a structuring element. The conditional erosion of M by E restricted to R is 𝑀 ⊖𝑅 𝐸 = 𝑀 ⊖ 𝐸 ∨ 𝑅 Superior reconstruction
  • 127. Repeating the conditional erosion 126 One can repeat the conditional erosion: We can define the superior reconstruction: Let 𝑅, 𝑀: 𝐴 ⊂ ℤ𝑛 → 𝐵, and let 𝐸 ⊂ ℤ𝑛 , (𝑀 ⊖𝑅 𝐸)𝑛= (( 𝑀 ⊖𝑅 𝐸 ⊖𝑅 𝐸) … ⊖𝑅 𝐸) (n times) Superior reconstruction The superior reconstruction of R by E from M is 𝑅 𝛻𝐸 𝑀 = (𝑀 ⊖𝑅 𝐸)∞ (repeat conditional erosion until stability).
  • 128. Superior reconstruction The superior reconstruction is well defined, as it will converge after a finite number of steps: it is decreasing and has R as a lower bound. In a discrete space, this is enough for achieving convergence in a finite number of steps. There exists 𝑘 ∈ ℕ such that 𝑅 𝛻𝐸 𝑀 = (𝑀 ⊖𝑅 𝐸)𝑘 Superior reconstruction
  • 129. Effect of the superior reconstruction on a binary image 128 Superior reconstruction 𝑀 𝑅 𝑅 𝛻Γ8 𝑀
  • 130. Effect of the superior reconstruction on a binary image 129 Let R and M be binary images, such that 𝑀 ≥ 𝑅. (𝑅 𝛻𝐸 𝑀) is a binary image containing exactly the E-connected components of black pixels of R that have at least one pixel black in M. Superior reconstruction 𝑀 𝑅 ∆Γ8 𝑀 𝑅
  • 133. Understanding superior reconstruction If M ≥ R, then the result S has . The same canyons than image M, located at the same place . The same aspect than image R Superior reconstruction Superior Reconstruction 𝑆 = 𝑅 𝛻𝐸 𝑀 R M E S
  • 134. Understanding superior reconstruction 133 The result of the superior reconstruction of R by E from M has the same aspect than R, but only possesses canyon where M has canyon. Superior reconstruction R (two canyons) M (one canyon) R 𝛻Γ8 M (one canyon)
  • 135. Another grayscale example 134 R M (the frame is black, no canyon) 𝑅 𝛻Γ4 𝑀 Superior reconstruction
  • 136. Another grayscale example 135 The result of the superior reconstruction of R from M has the same apsect than R, and no canyon like M (a hole that is not completely surrounded by higher ground is not considered to be a canyon… therefore, the holes touching the border are not canyons). Superior reconstruction R M (no cayon) 𝐼 𝛻Γ4 𝑀 (no canyon)
  • 137. Closing by reconstruction 136 The closing by reconstruction consists in performing first a closing of an image by a structuring element F, and then reconstruct the original image from the closing using E: The structuring element E used for reconstruction is usually Γ4 or Γ8. The structuring element F used for closing has no constraint, and should be big enough to remove all undesirable canyons. Let R: 𝐴 ⊂ ℤ𝑛 → 𝐵, and 𝐸, 𝐹 ⊂ ℤ𝑛 , the closing by reconstruction (under E) of R by F is 𝑅 ⦁𝐸 𝐹 = 𝑅 𝛻𝐸 𝑅 ⦁ 𝐹 Closing by reconstruction
  • 138. Application to noise removal 137 Example: We have pepper noise on an image Closing by reconstruction 𝐼𝑚 𝐼𝑚 ⦁ 2Γ8 𝐼𝑚 ⦁Γ4 2Γ8
  • 139. Properties of filters by reconstruction
  • 140. Partition 139 We recall the definition of a partition of a set : Let I be a set, and 𝑃 = {𝑃1, … , 𝑃𝑘} be a set of subsets of I. We say that P is a partition of I if ∀𝑖, 𝑗 ∈ 1; 𝑘 , 𝑖 ≠ 𝑗 ↔ 𝑃𝑖 ∩ 𝑃𝑗 = ∅ 𝑖∈[1;𝑘] 𝑃𝑖 = 𝐼 Properties of filters by reconstruction
  • 141. Exercise 140 Let E = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} Is {{0,3,7},{2,1,9,8},{4,5},{6,3}} a partition of E ? No, because 0,3,7 ∪ 6,3 ≠ ∅ Properties of filters by reconstruction
  • 142. Exercise 141 Let E = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} Is {{1, 8}, {3}, {9, 7, 2}, {5, 6}, {4}} a partition of E ? No, because 0 does not belong to any element of the partition. Properties of filters by reconstruction
  • 143. Exercise 142 Let E = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} Gives a partition of E with four elements at least. {{2,7,4}, {5,3}, {9,0,1,8}, {6}} Properties of filters by reconstruction
  • 144. Relation between partitions 143 There exists a partial order relation between partitions : Let I be a set, and P1 and P2 be two partitions of I. We say that P2 is coarser than P1 (and P1 is finer than P2) if each element of P1 is included in one element of P2. Properties of filters by reconstruction 𝑃1 : Each color represents one element of the partition 𝑃2 𝑷𝟐 is coarser than 𝑷𝟏 𝑃3 𝑷𝟏 and 𝑷𝟑 cannot be compared 𝑃4 𝑷𝟏 is coarser than 𝑷𝟒
  • 145. Relation between partitions 144 A partition 𝑃1 is coarser than a partition 𝑃2 if 𝑃1 can be obtained simply by merging elements of P2 together. In other words, the frontiers between the elements of 𝑃1 are included in the frontiers between the elements of 𝑃2. Properties of filters by reconstruction coarser than coarser than
  • 146. Natural partitioning of an image 145 In a grey level image, an E-flat zone is an E-connected component of pixels having the same value. The set of all the E-flat zones of an image represents the natural E- partitioning of a greyscale image. Ex : Natural 8-partitioning of image I (each partition has a different color). Properties of filters by reconstruction 2 3 5 2 3 2 3 5 2 3 2 2 2 1 3 2 1 1 1 3 4 1 1 4 4 I Natural 8-partitioning of I
  • 147. Connected filter 146 In other words, a connected filter acts on an image by merging together partitions of the natural partitioning of the image. Let 𝜓 ∶ A ⊂ ℤ𝑛 → 𝐵 → 𝐴 → 𝐵 be a filter that takes an image as input and produces an image as output. The transformation 𝜓 is E-connected if, for all image 𝐼: 𝐴 → 𝐵, the natural E-partitioning of 𝜓 𝐼 is coarser than the natural E- partitioning of I. Properties of filters by reconstruction
  • 148. Connected filter 147 All filters by reconstruction are connected filters. More precisely, a filter by reconstruction where the reconstruction is performed with a structuring element E, is an E- connected filter. Properties of filters by reconstruction
  • 149. Extensiveness 148 Opening and closing by reconstruction have an extensiveness property: the larger the structuring element used for the opening or closing, and the more flat zones of the image will be fusioned. Properties of filters by reconstruction Let 𝐼: 𝐴 ⊂ ℤ𝑛 → 𝐵 be an image, and 𝐸, 𝐹1, 𝐹2 ⊂ ℤ𝑛 be structuring elements, such that 𝐹1 ⊂ 𝐹2. The natural E-partitioning of (𝑅 ∘𝐸 𝐹2) is coarser than the natural E-partitioning of (𝑅 ∘𝐸 𝐹1). The natural E-partitioning of (𝑅 ⦁𝐸 𝐹2) is coarser than the natural E-partitioning of (𝑅 ⦁𝐸 𝐹1).
  • 150. Example 149 Properties of filters by reconstruction 𝐼 𝐼 ∘Γ4 12Γ8 𝐼 ∘Γ4 25Γ8 𝐼 ∘Γ4 50Γ8 53218 4-flat zones 39223 4-flat zones 28008 4-flat zones 14034 4-flat zones
  • 152. Definition 151 Alternate Sequential Filter, also called ASF, consists in performing sequentially openings and closings of an image with a structuring element whose size increases: These transformations are very useful in presence of additive and subtractive noise in the image. Let 𝐼: 𝐴 ⊂ ℤ𝑛 → 𝐵 and 𝐸 ⊆ ℤ𝑛, 𝐴𝑆𝐹𝑜𝑐 𝑛 𝐼, 𝐸 = ((((((𝐼 ∘ 𝐸) • 𝐸) ∘ 2𝐸) • 2𝐸) … ∘ 𝑛𝐸) • 𝑛𝐸) 𝐴𝑆𝐹𝑐𝑜 𝑛 𝐼, 𝐸 = ((((((𝐼 • 𝐸) ∘ 𝐸) • 2𝐸) ∘ 2𝐸) … • 𝑛𝐸) ∘ 𝑛𝐸) ASF
  • 153. Removing noise with ASF 152 Example : remove noise with only ONE opening and ONE closing ASF 𝐼𝑚 𝐼𝑚 ∘ 2Γ4 (𝐼𝑚 ∘ 2Γ4) • 15Γ4
  • 154. Removing noise with ASF 153 Example : remove noise with an ASF ASF 𝐼𝑚 𝐼𝑚 ∘ Γ4 𝐴𝑆𝐹𝑜𝑐 1 𝐼𝑚, Γ4 𝐴𝑆𝐹𝑜𝑐 1 𝐼𝑚, Γ4 ∘ 2Γ4 𝐴𝑆𝐹𝑜𝑐 2 𝐼𝑚, Γ4 𝐴𝑆𝐹𝑜𝑐 2 𝐼𝑚, Γ4 • 11Γ4 (𝐼𝑚 ∘ 2Γ4) • 15Γ4
  • 155. Connected ASF 154 We can go further with ASF and define connected ASF: Let 𝐼: 𝐴 ⊂ ℤ𝑛 → 𝐵 and 𝐸 ⊆ ℤ𝑛, 𝐶𝐴𝑆𝐹𝑜𝑐,𝐸 𝑛 𝐼, 𝐹 = ((((( 𝐼 ∘𝐸 𝐹 •𝐸 𝐹) ∘𝐸 2𝐹) •𝐸 2𝐹) … ∘𝐸 𝑛𝐹) •𝐸 𝑛𝐹) 𝐶𝐴𝑆𝐹𝑐𝑜,𝐸 𝑛 𝐼, 𝐹 = ((((( 𝐼 •𝐸 𝐹 ∘𝐸 𝐹) •𝐸 2𝐹) ∘𝐸 2𝐹) … •𝐸 𝑛𝐹) ∘𝐸 𝑛𝐹) ASF
  • 156. Connected ASF and noise 155 Example : remove noise with a connected ASF ASF 𝐼𝑚 𝐶𝐴𝑆𝐹𝑜𝑐,Γ4 2 𝐼𝑚, Γ4 𝐶𝐴𝑆𝐹𝑜𝑐,Γ4 2 𝐼𝑚, Γ4 ∘ 2Γ4 • 4Γ4 𝐴𝑆𝐹𝑜𝑐 2 𝐼𝑚, Γ4 • 11Γ4
  • 157. Decomposition through CASF 156 When looking at zones modified by the various steps of a connected ASF, we can see that they modify and merge larger zones of the image, as the structuring element grows. ASF Im
  • 158. Decomposition through CASF 157 When looking at zones modified by the various steps of a connected ASF, we can see that they modify and merge larger zones of the image, as the structuring element grows, creating a scale space decomposition of the image. ASF The red zones show what is modified by the current step of the ASF compared to previous step. 𝐶𝐴𝑆𝐹𝑜𝑐,Γ8 𝑛 𝐼𝑚, 𝐵(𝑛)
  • 160. h-extrema 159 The goal of h-extrema filters is to remove mountains or canyons based on their relative height, and not their shape. Unlike all the other morphological filters we saw, h-extrema filters elements based on their height (colour) rather than their shape. For example, how would we do to remove mountains having a height smaller than 30 in the image beneath? h-maxima and h-minima 30 𝐼 𝐼-30 𝐼 ∆𝐸 (𝐼 − 30) E
  • 161. Definition 160 We define h-maxima: We define h-minima: Let 𝐼: 𝐴 ⊂ ℤ𝑛 → 𝐵, 𝐸 ⊂ ℤ𝑛 and ℎ ∈ 𝐵, h-maxima of I under E is 𝐻𝑀𝐴𝑋ℎ,𝐸 𝐼 = 𝐼 Δ𝐸 (𝐼 − ℎ) h-maxima and h-minima Let 𝐼: 𝐴 ⊂ ℤ𝑛 → 𝐵, 𝐸 ⊂ ℤ𝑛 and ℎ ∈ 𝐵, h-minima of I under E is 𝐻𝑀𝐼𝑁ℎ,𝐸 𝐼 = 𝐼 𝛻𝐸 (𝐼 + ℎ)
  • 162. Properties 161 The h-maxima removes all mountains whose height is inferior or equal to h, but also lowers the other mountains by an altitude of h (same for h- minima with canyons). h-maxima and h-minima
  • 163. Local extremum 162 A local maximum (or minimum) is a set of pixels that is not surrounded by pixels of higher (lower) altitude. Ex : h-maxima and h-minima
  • 164. Local extrema 163 How can we obtain local maximum (minimum) in an image ? A local maximum is a set of pixels who are sourrounded by pixels of lower altitude: it is therefore the top of a mountain of altitude at least 1. A 1-maxima will remove all mountains top of the image, therefore, all the local maxima. With a subtraction, we can extract only the mountain tops that we removed. h-maxima and h-minima
  • 165. Local extrema 164 h-maxima and h-minima 𝐼𝑚 𝐻𝑀𝐴𝑋1,𝐸(𝐼𝑚) E 𝐼𝑚 𝐻𝑀𝐴𝑋1,𝐸(𝐼𝑚) 𝐼𝑚 − 𝐻𝑀𝐴𝑋1,𝐸(𝐼𝑚)
  • 166. Local extrema 165 We can define the transformation allowing to extract local (or regional) minima and maxima: The local minima and maxima transformations produce a binary image, with pixels being equal to 0 or 1. Let 𝐼: 𝐴 ⊂ ℤ𝑛 → 𝐵 and 𝐸 ⊂ ℤ𝑛 , 𝑅𝑀𝐴𝑋𝐸 𝐼 = 𝐼 − 𝐻𝑀𝐴𝑋1,𝐸(𝐼) (local maxima) 𝑅𝑀𝐼𝑁𝐸 𝐼 = 𝐻𝑀𝐼𝑁1,𝐸 𝐼 − 𝐼 (local minima) h-maxima and h-minima
  • 167. Application 166 H-maxima and h-minima, combined with local maxima and local minima can be very efficient to filter objects depending on their relative heights. Consider the following image, where we want to remove small mountains (height smaller than 60) h-maxima and h-minima
  • 168. Application 167 Consider the following image, where we want to remove small mountains (height smaller than 60) h-maxima and h-minima Mountains to keep Mountains to remove
  • 169. Application 168 These two mountains have the same absolute height, so a threshold won’t work to isolate the mountains we want to keep… h-maxima and h-minima
  • 170. Application 169 Some mountains are large, and some are thin… An opening won’t allow neither to isolate the good mountains. h-maxima and h-minima
  • 171. Application 170 Idea: Apply a 60-maxima in order to remove small mountains… h-maxima and h-minima (I-60) 𝐻𝑀𝐴𝑋60,Γ4 𝐼 Notice that the mountains we want to keep didn’t go under their own base after the subtraction, so still exist as mountains after h-maxima…
  • 172. 𝐻𝑀𝐴𝑋60,Γ4 𝐼 Application 171 Idea: Then, calculate a regional maxima of the image in order to extract remaining mountains (the ones higher than 60). h-maxima and h-minima 𝑅𝑀𝐴𝑋Γ8 (𝐻𝑀𝐴𝑋60,Γ4 𝐼 )
  • 173. 𝑅𝑀𝐴𝑋Γ8 (𝐻𝑀𝐴𝑋60,Γ4 𝐼 ) Application 172 Idea: Finally, reconstruct the original image from these regional maxima, which are the summit of the mountains we wanted to keep h-maxima and h-minima 𝐼 ΔΓ8 (𝑅𝑀𝐴𝑋Γ8 𝐻𝑀𝐴𝑋60,Γ4 𝐼 )
  • 175. Watershed 174 The Watershed is a segmentation algorithm: it allows to find the frontiers of a particular object in an image. The gradient allowed to find the frontiers of all the objects in the image. Here, we want to extract the frontiers of a particular object. Watershed transformation Original image Gradient
  • 176. Marker image In order to work, the algorithm needs a marker image, where the user will have identified the location of at least one pixel of the object to extract, and one pixel of its complement. The marker image allows to give, to the algorithm, some knowledge about the object to extract. Watershed transformation x x One pixels marked as outside of the flower One pixel marked as inside the flower 175
  • 177. The gradient image We finally need a gradient image where the contours of the objects on the image appear bright. This image can be obtained with a morphological gradient algorithm. Watershed transformation Gradient 176
  • 178. Flooding We consider the gradient image to be a piece of land, with its mountains and canyons. We place, on this land, some water pumps that will flood the land with waters of different colour. Watershed transformation x x We put a pump here and another one there 177
  • 179. Flooding We consider the gradient image to be a piece of land, with its mountains and canyons. We place, on this land, some water pumps that will flood the land with waters of different colour. Watershed transformation . When both lakes will meet, their water won’t mix. . Two lakes of different colour will appear and grow little by little. 178
  • 180. Flooding 179 Here is the full flooding process illustrated: Watershed transformation
  • 181. Results Once the flooding process is finished, we look at which parts of the map is under the green lake. Watershed transformation These parts correspond to the pixels belonging to the flower. 180
  • 183. Algorithm We have: . I is the gradient image, . M is the marker image, where the marked pixels of the object are set to 1, the marked pixels of its complement are set to 2, and the others are set to 0. . E is a structuring element Watershed transformation 182
  • 184. Algorithm Initialization: 𝐿 = ∅ 𝐹𝑜𝑟 𝑒𝑎𝑐ℎ 𝑝 𝑠𝑢𝑐ℎ 𝑡ℎ𝑎𝑡 𝑀 𝑝 > 0, 𝐿 = 𝐿 ∪ {𝑝} Main loop: 𝑊ℎ𝑖𝑙𝑒 𝐿 ≠ ∅ 𝐶ℎ𝑜𝑜𝑠𝑒 𝑥 ∈ 𝐿 𝑠𝑢𝑐ℎ 𝑡ℎ𝑎𝑡 𝐼 𝑥 ≤ 𝐼 𝑝 𝑓𝑜𝑟 𝑎𝑙𝑙 𝑝 ∈ 𝐿 𝐿 = 𝐿 𝑥 𝐹𝑜𝑟 𝑎𝑙𝑙 𝑦 ∈ 𝐸𝑥 𝑠𝑢𝑐ℎ 𝑡ℎ𝑎𝑡 𝑀 𝑦 = 0 𝑀 𝑦 = 𝑀 𝑥 𝐿 = 𝐿 ∪ {𝑦} Watershed transformation 183
  • 185. More than one object 184 We can also detect more than one object in the image by using more than two sets of markers. Watershed transformation Yeast cells Gradient x x x x x x x x Markers Result
  • 186. Conclusion 185 Watershed allows to find the precise frontiers of an object in an image. The input image must be a gradient image, where objects’ frontiers are highlighted. The difficult task consists in finding good markers, automatically if possible. Watershed transformation

Editor's Notes

  1. Insérer image avec frontière marquées ou fusion pixels
  2. Insérer image avec frontière marquées ou fusion pixels
  3. Insérer image avec frontière marquées ou fusion pixels
  4. Insérer image avec frontière marquées ou fusion pixels
  5. Ajouter animation
  6. Problème : extraire les contours d’un objet
  7. Propriétés de l’érosion et la dilatation : l’associativité – oui pour dilat, non pour erod
  8. Propriétés de l’érosion et la dilatation : l’associativité – oui pour dilat, non pour erod
  9. Propriétés de l’érosion et la dilatation : l’associativité – oui pour dilat, non pour erod
  10. Propriétés de l’érosion et la dilatation : l’associativité – oui pour dilat, non pour erod
  11. Propriétés de l’érosion et la dilatation : l’associativité – oui pour dilat, non pour erod
  12. Propriétés de l’érosion et la dilatation : l’associativité – oui pour dilat, non pour erod
  13. Propriétés de l’érosion et la dilatation : l’associativité – oui pour dilat, non pour erod
  14. Propriétés de l’érosion et la dilatation : l’associativité – oui pour dilat, non pour erod
  15. Illustration
  16. Illustration
  17. Exemple 2d gris large pour voir ce qui se passe, et histoire des chemins (avec expérience)
  18. Exemple 2d gris large pour voir ce qui se passe, et histoire des chemins (avec expérience)
  19. Exemple 2d gris large pour voir ce qui se passe, et histoire des chemins (avec expérience)
  20. Exemple 2d gris large pour voir ce qui se passe, et histoire des chemins (avec expérience)
  21. Exemple 2d gris large pour voir ce qui se passe, et histoire des chemins (avec expérience)
  22. Illustration
  23. Exemple 2d qui sert à quelquechose
  24. Exemple 2d plus grand, niveau de gris, pour voir les différences
  25. Illustration
  26. Illustration
  27. Exemple 2d gris large pour voir ce qui se passe, et histoire des chemins (avec expérience)
  28. Exemple 2d gris large pour voir ce qui se passe, et histoire des chemins (avec expérience)
  29. Exemple 2d gris large pour voir ce qui se passe, et histoire des chemins (avec expérience)
  30. Exemple 2d sur image avec trous, et histoire des chemins…
  31. Exemple 2d gris large pour voir ce qui se passe, et histoire des chemins (avec expérience)
  32. Illustration
  33. Exemple 2d plus grand, niveau de gris, pour voir les différences
  34. Exemple image niveau de gris, ouverture par reconstruction, fermeture par reconstruction…. Trouver image grande, mais pas trop, pour voir les partitions… et compter zones plates
  35. Exemple d’asf
  36. Exemple d’asf
  37. Exemple d’asf
  38. Exemple sur image, et montrer zones plates et leurs nombres
  39. Exemple sur image, et montrer zones plates et leurs nombres
  40. Exemple signal 1d
  41. Exemple 1d simple avec maximum régionaux
  42. Toujours le même exemple, avec 1-maxima…
  43. Toujours le même exemple, avec 1-maxima…
  44. Count the rings on the mountains to see if they are tall or not… Explain that height of the mountain depends on its base…
  45. Count the rings on the mountains to see if they are tall or not… Explain that height of the mountain depends on its base…
  46. Count the rings on the mountains to see if they are tall or not… Explain that height of the mountain depends on its base…
  47. See that many mountains still exist after the subtraction, even the ones we don’t want to keep
  48. See that many mountains still exist after the subtraction, even the ones we don’t want to keep
  49. See that many mountains still exist after the subtraction, even the ones we don’t want to keep
  50. Exemple pour trouver des marqueurs associés à des cellules…