Download - CP0666_03-Apr-2012_RM01
-
8/13/2019 CP0666_03-Apr-2012_RM01
1/62
-
8/13/2019 CP0666_03-Apr-2012_RM01
2/62
2
of
39Contents
Once segmentation is complete,morphological operations can be used to
remove imperfections in the segmented
image and provide information on the formand structure of the image
In this lecture we will consider
What is morphology? Simple morphological operations
Compound operations
Morphological algorithms
-
8/13/2019 CP0666_03-Apr-2012_RM01
3/62
3
of
391, 0, Black, White?
Throughout all of the following slideswhether 0 and 1 refer to white or black is a
little interchangeable
All of the discussion that follows assumessegmentation has already taken place and
that images are made up of 0s for
background pixels and 1s for object pixelsAfter this it doesnt matter if 0 is black, white,
yellow, green.
-
8/13/2019 CP0666_03-Apr-2012_RM01
4/62
-
8/13/2019 CP0666_03-Apr-2012_RM01
5/62
5
of
39Quick Example
Image after segmentation Image after segmentation and
morphological processing
-
8/13/2019 CP0666_03-Apr-2012_RM01
6/62
6
of
39Structuring Elements, Hits & Fits
B
A
C
Structuring Element
Fit:All on pixelsin the
structuring element coveron pixelsin the image
Hit:Any on pixelin the
structuring element coversan on pixelin the image
All morphological processing operations are based
on these simple ideas
-
8/13/2019 CP0666_03-Apr-2012_RM01
7/62
7
of
39Structuring Elements
Structuring elements can be any size andmake any shape
However, for simplicity we will use
rectangular structuring elements with theirorigin at the middle pixel
1 1 11 1 1
1 1 1
0 0 1 0 0
0 1 1 1 0
1 1 1 1 1
0 1 1 1 0
0 0 1 0 0
0 1 01 1 1
0 1 0
-
8/13/2019 CP0666_03-Apr-2012_RM01
8/62
8
of
39Fitting & Hitting
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 1 1 1 1 1 0 0 0 0 0
0 1 1 1 1 1 1 1 0 0 0 0
0 1 1 1 1 1 1 1 0 0 0 0
0 0 1 1 1 1 1 1 0 0 0 0
0 0 1 1 1 1 1 1 1 0 0 00 0 1 1 1 1 1 1 1 1 1 0
0 0 0 0 0 1 1 1 1 1 1 0
0 0 0 0 0 0 0 0 0 0 0 0
B C
A
1 1 1
1 1 1
1 1 1
Structuring
Element 1
0 1 0
1 1 1
0 1 0
Structuring
Element 2
-
8/13/2019 CP0666_03-Apr-2012_RM01
9/62
9
of
39Fundamental Operations
Fundamentally morphological imageprocessing is very like spatial filtering
The structuring element is moved across
every pixel in the original image to give apixel in a new processed image
The value of this new pixel depends on the
operation performedThere are two basic morphological
operations: erosion and dilation
-
8/13/2019 CP0666_03-Apr-2012_RM01
10/62
10
of
39Erosion
Erosion of imagefby structuring elementsis given byf s
The structuring element s is positioned with
its origin at (x, y)and the new pixel value isdetermined using the rule:
otherwise0
fitsif1
),(
fs
yxg
-
8/13/2019 CP0666_03-Apr-2012_RM01
11/62
11
of
39Erosion Example
Structuring Element
Original Image Processed Image With Eroded Pixels
-
8/13/2019 CP0666_03-Apr-2012_RM01
12/62
12
of
39Erosion Example
Structuring Element
Original Image Processed Image
-
8/13/2019 CP0666_03-Apr-2012_RM01
13/62
-
8/13/2019 CP0666_03-Apr-2012_RM01
14/62
14
of
39Erosion Example 2
Original
image
After erosion
with a disc of
radius 10
After erosionwith a disc of
radius 20
After erosion
with a disc of
radius 5
-
8/13/2019 CP0666_03-Apr-2012_RM01
15/62
15
of
39What Is Erosion For?
Erosion can split apart joined objects
Erosion can strip away extrusions
Watch out:Erosion shrinks objects
Erosion can split apart
-
8/13/2019 CP0666_03-Apr-2012_RM01
16/62
16
of
39Dilation
Dilation of imagefby structuring elementsisgiven byf s
The structuring element s is positioned with
its origin at (x, y)and the new pixel value isdetermined using the rule:
otherwise0
hitsif1
),(
fs
yxg
-
8/13/2019 CP0666_03-Apr-2012_RM01
17/62
17
of
39Dilation Example
Structuring Element
Original Image Processed Image
-
8/13/2019 CP0666_03-Apr-2012_RM01
18/62
18
of
39Dilation Example
Structuring Element
Original Image Processed Image With Dilated Pixels
-
8/13/2019 CP0666_03-Apr-2012_RM01
19/62
19
of
39Dilation Example 1
Original image Dilation by 3*3
square structuring
element
Dilation by 5*5
square structuring
element
Watch out:In these examples a 1 refers to a black pixel!
-
8/13/2019 CP0666_03-Apr-2012_RM01
20/62
20
of
39Dilation Example 2
Structuring element
Original image After dilation
-
8/13/2019 CP0666_03-Apr-2012_RM01
21/62
21
of
39What Is Dilation For?
Dilation can repair breaks
Dilation can repair intrusions
Watch out:Dilation enlarges objects
-
8/13/2019 CP0666_03-Apr-2012_RM01
22/62
22
of
39Compound Operations
More interesting morphological operationscan be performed by performing
combinations of erosions and dilations
The most widely used of these compoundoperationsare:
Opening
Closing
-
8/13/2019 CP0666_03-Apr-2012_RM01
23/62
23
of
39Opening
The opening of imagefby structuringelements,denotedf sis simply an erosion
followed by a dilation
f s = (f s) s
Original shape After erosion After dilation
(opening)
Note a disc shaped structuring element is used
-
8/13/2019 CP0666_03-Apr-2012_RM01
24/62
24
of
39Opening Example
Original
Image
Image
After
Opening
-
8/13/2019 CP0666_03-Apr-2012_RM01
25/62
25
of
39Opening Example
Structuring Element
Original Image Processed Image
-
8/13/2019 CP0666_03-Apr-2012_RM01
26/62
26
of
39Opening Example
Structuring Element
Original Image Processed Image
-
8/13/2019 CP0666_03-Apr-2012_RM01
27/62
-
8/13/2019 CP0666_03-Apr-2012_RM01
28/62
28
of
39Closing Example
Original
Image
Image
After
Closing
-
8/13/2019 CP0666_03-Apr-2012_RM01
29/62
29
of
39Closing Example
Structuring Element
Original Image Processed Image
-
8/13/2019 CP0666_03-Apr-2012_RM01
30/62
30
of
39Closing Example
Structuring Element
Original Image Processed Image
-
8/13/2019 CP0666_03-Apr-2012_RM01
31/62
31
of
39Morphological Processing Example
-
8/13/2019 CP0666_03-Apr-2012_RM01
32/62
32
of
39Morphological Algorithms
Using the simple technique we have lookedat so far we can begin to consider some
more interesting morphological algorithms
We will look at: Boundary extraction
Region filling
There are lots of others as well though: Extraction of connected components
Thinning/thickening
Skeletonisation
33
-
8/13/2019 CP0666_03-Apr-2012_RM01
33/62
33
of
39Boundary Extraction
Extracting the boundary (or outline) of anobject is often extremely useful
The boundary can be given simply as
(A) = A (AB)
34
-
8/13/2019 CP0666_03-Apr-2012_RM01
34/62
34
of
39Boundary Extraction Example
A simple image and the result of performingboundary extraction using a square 3*3
structuring element
Original Image Extracted Boundary
35
-
8/13/2019 CP0666_03-Apr-2012_RM01
35/62
35
of
39Region Filling
Given a pixel inside a boundary, regionfillingattempts to fill that boundary with
object pixels (1s)
Given a point inside
here, can we fill thewhole circle?
36
-
8/13/2019 CP0666_03-Apr-2012_RM01
36/62
36
of
39Region Filling (cont)
The key equation for region filling is
Where X0is simply the starting point inside
the boundary, B is a simple structuring
element and Acis the complement of A
This equation is applied repeatedly until Xk
is equal to Xk-1
Finally the result is unioned with the original
boundary
.....3,2,1)( 1 kABXX c
kk
37
-
8/13/2019 CP0666_03-Apr-2012_RM01
37/62
37
of
39Region Filling Step By Step
Im
agestakenfromGonza
lez&Woods,
DigitalImageProcessing(2002)
38
-
8/13/2019 CP0666_03-Apr-2012_RM01
38/62
38
of
39Region Filling Example
Original Image One RegionFilled
All RegionsFilled
39
-
8/13/2019 CP0666_03-Apr-2012_RM01
39/62
39
of
39
39
Extraction of connected components
40
-
8/13/2019 CP0666_03-Apr-2012_RM01
40/62
40
of
39
40
Example
41
-
8/13/2019 CP0666_03-Apr-2012_RM01
41/62
41
of
39 Convex hull
A setAis
said to be
convex if thestraight line
segment
joining any
two points in
A lies
entirely
within A.
i
i DAC
4
1)(
,...3,2,1and4,3,2,1)( kiABXX ii
k
i
k
41
42
-
8/13/2019 CP0666_03-Apr-2012_RM01
42/62
42
of
39
42
43
-
8/13/2019 CP0666_03-Apr-2012_RM01
43/62
43
of
39
43
Thinning
cBAA
BAABA
)(
)(
44
-
8/13/2019 CP0666_03-Apr-2012_RM01
44/62
44
of
39
44
Thickening
)( BAABA
45
-
8/13/2019 CP0666_03-Apr-2012_RM01
45/62
45
of
39
45
SkeletonsK
kk ASAS0
)()(
BkBAkBAASk )()()( })(|max{ kBAkK
))((0
kBASA k
K
k
46
-
8/13/2019 CP0666_03-Apr-2012_RM01
46/62
46
of
39
46
-
8/13/2019 CP0666_03-Apr-2012_RM01
47/62
48
-
8/13/2019 CP0666_03-Apr-2012_RM01
48/62
48
of
39
48
49
-
8/13/2019 CP0666_03-Apr-2012_RM01
49/62
49
of
39
49
50
-
8/13/2019 CP0666_03-Apr-2012_RM01
50/62
50
of
39
50
51
-
8/13/2019 CP0666_03-Apr-2012_RM01
51/62
51
of
39
51
52
-
8/13/2019 CP0666_03-Apr-2012_RM01
52/62
5
of
39
52
5 basic structuring elements
53
S
-
8/13/2019 CP0666_03-Apr-2012_RM01
53/62
of
39Summary
The purpose of morphological processing isprimarily to remove imperfections added during
segmentation
The basic operations are erosionand dilationUsing the basic operations we can perform
openingand closing
More advanced morphological operation canthen be implemented using combinations of all
of these
54
S i El Hi & Fi
-
8/13/2019 CP0666_03-Apr-2012_RM01
54/62
of
39Structuring Elements, Hits & Fits
55
-
8/13/2019 CP0666_03-Apr-2012_RM01
55/62
of
39
HIT! F
IT!
-
8/13/2019 CP0666_03-Apr-2012_RM01
56/62
57
E i E l
-
8/13/2019 CP0666_03-Apr-2012_RM01
57/62
of
39Erosion Example
Structuring Element
58
Dil ti E l
-
8/13/2019 CP0666_03-Apr-2012_RM01
58/62
of
39Dilation Example
Structuring Element
59
O i E l
-
8/13/2019 CP0666_03-Apr-2012_RM01
59/62
of
39Opening Example
Structuring Element
Original Image Processed Image
60
Cl i E l
-
8/13/2019 CP0666_03-Apr-2012_RM01
60/62
of
39Closing Example
Structuring Element
Original Image Processed Image
61
R i Filli St B St
-
8/13/2019 CP0666_03-Apr-2012_RM01
61/62
of
39Region Filling Step By Step
-
8/13/2019 CP0666_03-Apr-2012_RM01
62/62