mathematical morphology - cmpcmp.felk.cvut.cz/.../lecture_morphology_sara.pdf · mathematical...
TRANSCRIPT
![Page 1: Mathematical Morphology - CMPcmp.felk.cvut.cz/.../lecture_morphology_sara.pdf · Mathematical Morphology A mathematical tool for the extraction and analysis of discrete quantized](https://reader030.vdocuments.net/reader030/viewer/2022041117/5f2c629365e876540c6e71bb/html5/thumbnails/1.jpg)
1
Mathematical Morphology
A mathematical tool for the extraction and analysis ofdiscrete quantized image structure.
• Does not change image representation.(It is a system of transformations from the space ofdiscrete quantized images onto itself.)
• Implemented as set-theoretic operations withstructuring elements.
• Fast algorithms (quasi-paralel processing), manyapplications, mainly microscopy image processing.
Mathematical Morphology R. Sara
![Page 2: Mathematical Morphology - CMPcmp.felk.cvut.cz/.../lecture_morphology_sara.pdf · Mathematical Morphology A mathematical tool for the extraction and analysis of discrete quantized](https://reader030.vdocuments.net/reader030/viewer/2022041117/5f2c629365e876540c6e71bb/html5/thumbnails/2.jpg)
2
Binary Mathematical Morphology
Motivation example: pre-processing for hand-writtencharacter recognition
Mathematical Morphology R. Sara
![Page 3: Mathematical Morphology - CMPcmp.felk.cvut.cz/.../lecture_morphology_sara.pdf · Mathematical Morphology A mathematical tool for the extraction and analysis of discrete quantized](https://reader030.vdocuments.net/reader030/viewer/2022041117/5f2c629365e876540c6e71bb/html5/thumbnails/3.jpg)
3
Literature
Serra, J. Image Analysis and MathematicalMorphology. Academic Press, London 1982
Hlav, V. and onka, M. Potaov vidn. Grada Praha,1992 (str. 76–96)
onka, M. Hlav, V., Boyle, R. Image Processing,Analysis, and Machine Vision. Thomson, 1998. (str.559–598).
Haralick, R. M, Shapiro, Linda G. Computer andRobot Vision. Addison Wesley, 1992 (str. 157–262)
Gonzalez, R. C., Woods, R. E. Digital ImageProcessing. Addison Wesley, 1992 (str. 518–566)
Mathematical Morphology R. Sara
![Page 4: Mathematical Morphology - CMPcmp.felk.cvut.cz/.../lecture_morphology_sara.pdf · Mathematical Morphology A mathematical tool for the extraction and analysis of discrete quantized](https://reader030.vdocuments.net/reader030/viewer/2022041117/5f2c629365e876540c6e71bb/html5/thumbnails/4.jpg)
4
Representation of imageand the structuring element
• image = a set of labeled vertices (pixels)
• a regular rectangular (or hexagonal) grid in thespace of dimension n (here n = 2)
• binary (integer) values
0 0 0000
1000 0 0 0
01 10
00
origin unspecified
• we will assume zero values behind image edges
• binary morphology is based on set-theoreticoperations with images
Mathematical Morphology R. Sara
![Page 5: Mathematical Morphology - CMPcmp.felk.cvut.cz/.../lecture_morphology_sara.pdf · Mathematical Morphology A mathematical tool for the extraction and analysis of discrete quantized](https://reader030.vdocuments.net/reader030/viewer/2022041117/5f2c629365e876540c6e71bb/html5/thumbnails/5.jpg)
5
Mathematical Morphology: Notation
X, Y – discrete quantized image
B, E, L – structural element
D(B) – domain of structural element B
Xc – complement of set X
Xh – translation of set X by vector h
X ⊕B – dilation (of X by B)
X B – erosion
X ◦B – opening
X •B – closing
β(X) – morphological gradient of X
X ⊗B – Serra transform (hit-or-miss)
X �B – thinning
Mathematical Morphology R. Sara
![Page 6: Mathematical Morphology - CMPcmp.felk.cvut.cz/.../lecture_morphology_sara.pdf · Mathematical Morphology A mathematical tool for the extraction and analysis of discrete quantized](https://reader030.vdocuments.net/reader030/viewer/2022041117/5f2c629365e876540c6e71bb/html5/thumbnails/6.jpg)
6
Translation Xh
Xh(p) = X(p− h), p ∈ X ⊂ Z2
Example:
h = (1, 2)
X Xh
�
Mathematical Morphology R. Sara
![Page 7: Mathematical Morphology - CMPcmp.felk.cvut.cz/.../lecture_morphology_sara.pdf · Mathematical Morphology A mathematical tool for the extraction and analysis of discrete quantized](https://reader030.vdocuments.net/reader030/viewer/2022041117/5f2c629365e876540c6e71bb/html5/thumbnails/7.jpg)
7
Binary Dilation X ⊕B
X ⊕B =⋃
{y, B(y)=1}
Xy
Example:
X B X ⊕B
X ⊕B = X(0,0) ∪X(1,0)
�
• Locus of all non-zero image pixels translated by theset of vectors defined by the structuring element.
Mathematical Morphology R. Sara
![Page 8: Mathematical Morphology - CMPcmp.felk.cvut.cz/.../lecture_morphology_sara.pdf · Mathematical Morphology A mathematical tool for the extraction and analysis of discrete quantized](https://reader030.vdocuments.net/reader030/viewer/2022041117/5f2c629365e876540c6e71bb/html5/thumbnails/8.jpg)
8
Binary Dilation Example
X
B
X ⊕B
Mathematical Morphology R. Sara
![Page 9: Mathematical Morphology - CMPcmp.felk.cvut.cz/.../lecture_morphology_sara.pdf · Mathematical Morphology A mathematical tool for the extraction and analysis of discrete quantized](https://reader030.vdocuments.net/reader030/viewer/2022041117/5f2c629365e876540c6e71bb/html5/thumbnails/9.jpg)
9
Dilation Properties
Observation: decomposability of element B
= ⊕ = ⊕ ⊕
B = D3 ⊕ S3,3 = D3 ⊕ S1,3 ⊕ S3,1
1. X ⊕B = B ⊕X
2. X ⊕ (B ⊕D) = (X ⊕B)⊕D decomposable element
3. X ⊕ (B ∪D) = (X ⊕B) ∪ (X ⊕D)
= ∪
4. X ⊕B 6⊇ X dilation is not ‘inflation’
⊕ =
5. · · ·
Mathematical Morphology R. Sara
![Page 10: Mathematical Morphology - CMPcmp.felk.cvut.cz/.../lecture_morphology_sara.pdf · Mathematical Morphology A mathematical tool for the extraction and analysis of discrete quantized](https://reader030.vdocuments.net/reader030/viewer/2022041117/5f2c629365e876540c6e71bb/html5/thumbnails/10.jpg)
10
Binary Erosion X B
X B =⋂
{y, B(y)=1}
X−y
Example:
X B X B
X B = X(0,0) ∩X(−1,0)
�
• Erosion: Locus of (non-zero) image pixels to whichstructuring element B can be inserted
Mathematical Morphology R. Sara
![Page 11: Mathematical Morphology - CMPcmp.felk.cvut.cz/.../lecture_morphology_sara.pdf · Mathematical Morphology A mathematical tool for the extraction and analysis of discrete quantized](https://reader030.vdocuments.net/reader030/viewer/2022041117/5f2c629365e876540c6e71bb/html5/thumbnails/11.jpg)
11
Binary Erosion Example
X
B
X B
(X B)⊕ B
• Observation: (X B)⊕B 6= X
Mathematical Morphology R. Sara
![Page 12: Mathematical Morphology - CMPcmp.felk.cvut.cz/.../lecture_morphology_sara.pdf · Mathematical Morphology A mathematical tool for the extraction and analysis of discrete quantized](https://reader030.vdocuments.net/reader030/viewer/2022041117/5f2c629365e876540c6e71bb/html5/thumbnails/12.jpg)
12
Erosion Properties
1. X B 6= B X
=
=
2. X (B ⊕D) = (X B)D decomposable element
3. X (B ∪D) = (B X) ∩ (D Y )
4. If (0, 0) ∈ B then X B ⊆ X
= counter-example
5. (X ⊕B)B 6= X
⊕ =
= 6=
Mathematical Morphology R. Sara
![Page 13: Mathematical Morphology - CMPcmp.felk.cvut.cz/.../lecture_morphology_sara.pdf · Mathematical Morphology A mathematical tool for the extraction and analysis of discrete quantized](https://reader030.vdocuments.net/reader030/viewer/2022041117/5f2c629365e876540c6e71bb/html5/thumbnails/13.jpg)
13
6. (X B)⊕B 6= X
=
⊕ = 6=
7. · · ·
Mathematical Morphology R. Sara
![Page 14: Mathematical Morphology - CMPcmp.felk.cvut.cz/.../lecture_morphology_sara.pdf · Mathematical Morphology A mathematical tool for the extraction and analysis of discrete quantized](https://reader030.vdocuments.net/reader030/viewer/2022041117/5f2c629365e876540c6e71bb/html5/thumbnails/14.jpg)
14
Morphological Opening and Closing
X ◦B = (X B)⊕B opening
X •B = (X ⊕B)B closing
X
X ◦B
X •B
B
Mathematical Morphology R. Sara
![Page 15: Mathematical Morphology - CMPcmp.felk.cvut.cz/.../lecture_morphology_sara.pdf · Mathematical Morphology A mathematical tool for the extraction and analysis of discrete quantized](https://reader030.vdocuments.net/reader030/viewer/2022041117/5f2c629365e876540c6e71bb/html5/thumbnails/15.jpg)
15
Properies of Opening and Closing
1. idempotence
(X ◦B) ◦B = X ◦B
(X •B) •B = X •B
2. antiextensivity of opening
X ◦B ⊆ X
3. extensivity of closing
X ⊆ X •B
4. · · ·
Mathematical Morphology R. Sara
![Page 16: Mathematical Morphology - CMPcmp.felk.cvut.cz/.../lecture_morphology_sara.pdf · Mathematical Morphology A mathematical tool for the extraction and analysis of discrete quantized](https://reader030.vdocuments.net/reader030/viewer/2022041117/5f2c629365e876540c6e71bb/html5/thumbnails/16.jpg)
16
Morphological Gradient β(X)
β(X) = X \ (X S3,3)
Example:
X X S3,3 β(X)
S3,3 =
�
Remarks
• interior boundary
• 4-connectivity
• exterior boundary: β∗(X) = (X ⊕ S3,3) \X
Mathematical Morphology R. Sara
![Page 17: Mathematical Morphology - CMPcmp.felk.cvut.cz/.../lecture_morphology_sara.pdf · Mathematical Morphology A mathematical tool for the extraction and analysis of discrete quantized](https://reader030.vdocuments.net/reader030/viewer/2022041117/5f2c629365e876540c6e71bb/html5/thumbnails/17.jpg)
17
Morphological Gradient Example
X
β(X)
β∗(X)
Mathematical Morphology R. Sara
![Page 18: Mathematical Morphology - CMPcmp.felk.cvut.cz/.../lecture_morphology_sara.pdf · Mathematical Morphology A mathematical tool for the extraction and analysis of discrete quantized](https://reader030.vdocuments.net/reader030/viewer/2022041117/5f2c629365e876540c6e71bb/html5/thumbnails/18.jpg)
18
Serra Transform (Hit-or-Miss)
X ⊗B = (X B1) ∩ (Xc B2)
correlation with two constraints
B = {B1, B2}, B1 ∩B2 = ∅:
1. X B1 – locus of object pixels similar to B1
2. Xc B2 – locus of background pixels similar to B2
• not every pair B gives X ⊗B 6= ∅
Example:
detection of “endpoints” from the left:
B = : B1 = , B2 =
X X ⊗B
Mathematical Morphology R. Sara
![Page 19: Mathematical Morphology - CMPcmp.felk.cvut.cz/.../lecture_morphology_sara.pdf · Mathematical Morphology A mathematical tool for the extraction and analysis of discrete quantized](https://reader030.vdocuments.net/reader030/viewer/2022041117/5f2c629365e876540c6e71bb/html5/thumbnails/19.jpg)
19
Sequential Thinning
X �B = X \ (X ⊗B)
X � {Bi}ni=1 = X �B1 �B2 � · · · �Bn
• the result is order-dependent!
Example:
X L1 X � L1 �
Golay alphabet:
· · ·L1 L2 L3 L4 · · · L8
E1 E2 E3 E4
Mathematical Morphology R. Sara
![Page 20: Mathematical Morphology - CMPcmp.felk.cvut.cz/.../lecture_morphology_sara.pdf · Mathematical Morphology A mathematical tool for the extraction and analysis of discrete quantized](https://reader030.vdocuments.net/reader030/viewer/2022041117/5f2c629365e876540c6e71bb/html5/thumbnails/20.jpg)
20
Sequential Thinning Example
image I
X = (I < 245)
Y = X ◦ S3,3
Y � {Li}8i=1, repeat till convergence
our goal: smoothed skeleton (see later)
Mathematical Morphology R. Sara
![Page 21: Mathematical Morphology - CMPcmp.felk.cvut.cz/.../lecture_morphology_sara.pdf · Mathematical Morphology A mathematical tool for the extraction and analysis of discrete quantized](https://reader030.vdocuments.net/reader030/viewer/2022041117/5f2c629365e876540c6e71bb/html5/thumbnails/21.jpg)
21
Skeleton1 Smoothing
Input: skeleton X
1. shortening of endings n-times (n = 8)
X1 =⟨X � {Ei}4
i=1
⟩n
k=1
2. ending point detection
X2 =4⋃
i=1
(X ⊗ Ei)
3. conditional dilation n-times (n = 8)
X3 =⟨(X2 ⊕ S3,3) ∩X
⟩n
k=1
4. smoothed skeleton
Y = X1 ∪X3
1I will call the result of sequential thinning a skeleton even if this is incorrect.
Mathematical Morphology R. Sara
![Page 22: Mathematical Morphology - CMPcmp.felk.cvut.cz/.../lecture_morphology_sara.pdf · Mathematical Morphology A mathematical tool for the extraction and analysis of discrete quantized](https://reader030.vdocuments.net/reader030/viewer/2022041117/5f2c629365e876540c6e71bb/html5/thumbnails/22.jpg)
22
Analogy with Convolution and Correlation
(X ⊕B)(x) =⋃
{y, B(y)=1}
Xy =⋃
{y, B(y)=1}
X(x− y)
(X B)(x) =⋂
{y, B(y)=1}
X−y =⋂
{y, B(y)=1}
X(x + y)
(X ⊕B)(x) = maxy∈D(B)
(X(x− y) + B(y)
)(X B)(x) = min
y∈D(B)
(X(x + y)−B(y)
)(f ∗ g)(x) =
∑y∈D(f)
f(y) g(x− y)
(f ~ g)(x) =∑
y∈D(f)
f∗(y) g(x + y)
convolution binary dilation gray-scale dilation
× ++ ∪ max
correlation binary erosion gray-scale erosion
× −+ ∩ min
Mathematical Morphology R. Sara
![Page 23: Mathematical Morphology - CMPcmp.felk.cvut.cz/.../lecture_morphology_sara.pdf · Mathematical Morphology A mathematical tool for the extraction and analysis of discrete quantized](https://reader030.vdocuments.net/reader030/viewer/2022041117/5f2c629365e876540c6e71bb/html5/thumbnails/23.jpg)
23
Gray-Scale Morphology
XC = C −X, C – maximum element (e.g. 255)
Xh(p) = X(p− h)
X ⊕B = maxy∈D(B)
X(x− y) + B(y)
X B = miny∈D(B)
X(x + y)−B(y)
X ◦B = (X B)⊕B
X •B = (X ⊕B)B
β(X) = X − (X S3,3)
X ⊗B = min(X B1, Xc B2)
X �B = X − (X ⊗B)
Mathematical Morphology R. Sara
![Page 24: Mathematical Morphology - CMPcmp.felk.cvut.cz/.../lecture_morphology_sara.pdf · Mathematical Morphology A mathematical tool for the extraction and analysis of discrete quantized](https://reader030.vdocuments.net/reader030/viewer/2022041117/5f2c629365e876540c6e71bb/html5/thumbnails/24.jpg)
24
Gray-Scale Morphology Examples
Example 1: Local maxima/minima detection in image:application of morphological gradient.
Example 2: Segmentation of cell boundaries in theimages of human cornea: application of morphologicalwatershed.
X {p} W (X, {p})
Mathematical Morphology R. Sara
![Page 25: Mathematical Morphology - CMPcmp.felk.cvut.cz/.../lecture_morphology_sara.pdf · Mathematical Morphology A mathematical tool for the extraction and analysis of discrete quantized](https://reader030.vdocuments.net/reader030/viewer/2022041117/5f2c629365e876540c6e71bb/html5/thumbnails/25.jpg)
25
Example 3: 100% visual quality inspection of amaximal thermometer capillary application of top hattransform.
X X ◦ S20,1 X −X ◦ S20,1
GRAY SCALE IMAGE OPENED IMAGE
THRESHOLDTOP HAT
Mathematical Morphology R. Sara
![Page 26: Mathematical Morphology - CMPcmp.felk.cvut.cz/.../lecture_morphology_sara.pdf · Mathematical Morphology A mathematical tool for the extraction and analysis of discrete quantized](https://reader030.vdocuments.net/reader030/viewer/2022041117/5f2c629365e876540c6e71bb/html5/thumbnails/26.jpg)
26
Example 4: Granulometry2
X largest square probes
0 10 20 30 40 50 60 70 80 90 1000
1000
2000
3000
4000
5000
6000
7000
granulometric spectre2Sorry for this example.
Mathematical Morphology R. Sara