04 Morphological Image Processing
04 Morphological Image Processing
1
Morphological Image Processing
2
Morphological Image Processing
3
Morphological operators
• Change the shape of the foreground regions via
intersection/union operations between a scanning
structuring element and binary image.
• Useful to clean up result from thresholding.
4
Dilation
• Dilation expands the connected sets of a binary image.
• It can be used for
• growing features
5
Ahmed Elgammal, Rutgers
Erosion
• Erosion shrinks the connected sets of a binary image.
• It can be used for
• shrinking features
6
Kristen Grauman, UT-Austin
Structuring elements
• Masks of varying shapes and sizes used to perform
morphology, for example:
7
Ahmed Elgammal, Rutgers
Example for Dilation (1D)
Input image
1 0 0 0 1 1 1 0 1 1
Structuring Element 1 1 1
g ( x) f ( x) SE
Output Image 1
8
Adapted from T. Moeslund
Example for Dilation
Input image
1 0 0 0 1 1 1 0 1 1
Structuring Element 1 1 1
Output Image 1 1
9
Example for Dilation
Input image
1 0 0 0 1 1 1 0 1 1
Structuring Element 1 1 1
Output Image 1 1 0
10
Example for Dilation
Input image
1 0 0 0 1 1 1 0 1 1
Structuring Element 1 1 1
Output Image 1 1 0 1
11
Example for Dilation
Input image
1 0 0 0 1 1 1 0 1 1
Structuring Element 1 1 1
Output Image 1 1 0 1 1 1
12
Example for Dilation
Input image
1 0 0 0 1 1 1 0 1 1
Structuring Element 1 1 1
Output Image 1 1 0 1 1 1 1
13
Example for Dilation
Input image
1 0 0 0 1 1 1 0 1 1
Structuring Element 1 1 1
Output Image 1 1 0 1 1 1 1 1
14
Example for Dilation
Input image
1 0 0 0 1 1 1 0 1 1
Structuring Element 1 1 1
Output Image 1 1 0 1 1 1 1 1
15
Example for Dilation
Input image
1 0 0 0 1 1 1 0 1 1
Structuring Element 1 1 1
Output Image 1 1 0 1 1 1 1 1 1
Note that the object gets bigger and holes are filled.
>> help imdilate
16
Dilation
17
Dilation
18
Dilation
19
Example for Erosion (1D)
Input image
1 0 0 0 1 1 1 0 1 1
1 1 1
Structuring Element _
g ( x) f ( x)OSE
Output Image 0
20
Example for Erosion (1D)
Input image
1 0 0 0 1 1 1 0 1 1
1 1 1
Structuring Element
g ( x) f ( x)O_ SE
Output Image 0 0
21
Example for Erosion
Input image
1 0 0 0 1 1 1 0 1 1
Structuring Element 1 1 1
Output Image 0 0 0
22
Example for Erosion
Input image
1 0 0 0 1 1 1 0 1 1
Structuring Element 1 1 1
Output Image 0 0 0 0
23
Example for Erosion
Input image
1 0 0 0 1 1 1 0 1 1
Structuring Element 1 1 1
Output Image 0 0 0 0 0
24
Example for Erosion
Input image
1 0 0 0 1 1 1 0 1 1
Structuring Element 1 1 1
Output Image 0 0 0 0 0 1
25
Example for Erosion
Input image
1 0 0 0 1 1 1 0 1 1
Structuring Element 1 1 1
Output Image 0 0 0 0 0 1 0
26
Example for Erosion
Input image
1 0 0 0 1 1 1 0 1 1
Structuring Element 1 1 1
Output Image 0 0 0 0 0 1 0 0
27
Example for Erosion
Input image
1 0 0 0 1 1 1 0 1 1
Structuring Element 1 1 1
Output Image 0 0 0 0 0 1 0 0 0
28
Example for Erosion
Input image
1 0 0 0 1 1 1 0 1 1
Structuring Element 1 1 1
Output Image 0 0 0 0 0 1 0 0 0 1
30
Erosion
31
Morphological Image Processing
32
Problem 9.6
33
Opening
• Erode, then dilate
• Remove small objects, keep original shape
34
Kristen Grauman, UT-Austin
Closing
• Dilate, then erode
• Fill holes, but keep original shape
35
Kristen Grauman, UT-Austin
Open and Close
36
Open and Close
37
Open and Close
38
Hit or Miss
39
Hit or Miss
40
Boundary Extraction
41
Boundary Extraction
42
Region Filling
43
Region Filling
44
Extraction of Connected Components
45
Extraction of Connected Components
46
Problem 9.17
47
Problem 9.17
48
Problem 9.36
A preprocessing step in an application
of microscopy is concerned with the
issue of isolating individual round
particles from similar particles that
overlap in groups of two or more
particles. Assuming that all particles are
of the same size, propose a
morphological algorithm that produces
three images consisting respectively of
(a) Only of particles that have merged
with the boundary of the image.
(b) Only overlapping particles.
(c) Only nonoverlapping particles.
49