Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory...
Transcript of Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory...
![Page 1: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/1.jpg)
Mathematical Morphologyand Distance Transforms
Vladimir CuricCentre for Image AnalysisSwedish University of Agricultural Sciences
Uppsala University
![Page 2: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/2.jpg)
About the teacher
PhD student at CBA
Background in mathematics
Research topic: Mathematical morphology and Discrete geometry
Distance measures in digital spacesAdaptive mathematical morphology
Contact: [email protected]
![Page 3: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/3.jpg)
Today’s lecture
Mathematical morphology
Distance transforms
Chapters 9.1− 9.6 in Gonzales-Woods book (for mathematicalmorphology)
Notes for Distance transforms
![Page 4: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/4.jpg)
Part 1
Mathematical Morphology
![Page 5: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/5.jpg)
Morphology in Britannica encyclopedia
Morphology, in biology, is the study of the size, shape, and structureof animals, plants, and micro-organisms and the relationships of theirinternal parts
Morphology, in linguistics, is the study of the internal construction ofwords
Mathematical morphology?
![Page 6: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/6.jpg)
History
Mathematical Morphology was founded in the mid-sixties in France
George Matheron and Jean Serra are two founders of mathematicalmorphology
Study of geometry of porous media
11th International Symposium on Mathematical MorphologyISMM’2013, May 27-29, Uppsala (http://ismm.cb.uu.se/)
![Page 7: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/7.jpg)
Mathematical morphology
The theory for the analysis of spatial structures
Analysis of shapes and objects
It is based on:
Discrete space: Set theory, Lattice algebraContinuous space: Partial differential equations
Structuring elements
![Page 8: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/8.jpg)
Set theory
The language of mathematical morphology is set theory
We will mostly work in Z2
Easy to extend to Zn
Can be extended to a continuous domain
If x = (x1, x2) is an element in X : x ∈ X
Today’s lecture covers only binary mathematical morphology(gray-scale mathematical morphology in Image Analysis 2)
![Page 9: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/9.jpg)
Some set theory
Empty set: ∅Every element in A is also in B (subset): A ⊂ B
Union of A and B : C = A ∪ B = {x |x ∈ A or x ∈ B}Intersection of A and B : C = A ∩ B = {x |x ∈ A and x ∈ B}Disjoint/mutually exclusive: A ∩ B = ∅
![Page 10: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/10.jpg)
Some more set theory
Complement of A: AC = {x |x 6∈ A}(OBS! with respect to which universe)
Difference of A and B : A \ B = {x |x ∈ A and x 6∈ B} = A ∩ BC
Reflection (Transposition) of A: A = {−a|a ∈ A}The set A is symmetric if and only if A = A
Translation of A by a vector z = (z1, z2):(A)Z = {x |x = a + z , a ∈ A}
![Page 11: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/11.jpg)
How to describe the SE
Small set used to probe the image under study
Possible to define in many different ways!
Information needed:
Position of origin for SE
Position of elements belonging to SE
![Page 12: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/12.jpg)
How to describe the SE
The shape and size must be adapted to geometric properties for theobjects
OBS!
Matlab assumes that the center of the structuring elements is itsorigin!
Matlab: SE = strel(shape, parameters)
![Page 13: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/13.jpg)
Five basic morphological operators
⊖ Erosion
⊕ Dilation
◦ Opening
• Closing
⊗ Hit-or-Miss transform
![Page 14: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/14.jpg)
⊖ Erosion
Does the structuring element fit the set?
Erosion of a set X by structuring element B , εB(X ) : all x in X suchthat B is in X when origin of B is x
εB(X ) = X ⊖ B = {x |Bx ⊂ X}
Shrinks the object
OBS!
Matlab: E = imerode(I,SE)
![Page 15: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/15.jpg)
⊖ Erosion - problem
![Page 16: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/16.jpg)
⊖ Erosion - result
![Page 17: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/17.jpg)
⊖ Erosion - Typical applications
Erosion
Removing structures of certain shape and size, given by SE
![Page 18: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/18.jpg)
⊖ Erosion - properties
1 It is increasing, i.e., if A ⊂ C , then A⊖ B ⊂ C ⊖ B
2 If the origin belongs to the structuring element B , then the erosion isanti-extensive, i.e., A⊖ B ⊂ A
3 It is distributive over set intersection, i.e.,(A1 ∩ A2)⊖ B = (A1 ⊖ B) ∩ (A2 ⊖ B)
4 It is translation invariant
![Page 19: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/19.jpg)
⊕ Dilation
Does the structuring element hit the set?
Dilation of a set X by structuring element B , δB(X ) : all x in X suchthat the reflection of B hits X when origin of B is x
δB(X ) = X ⊕ B = {x |(B)x ∩ X 6= ∅}
Enlarges the object
OBS!
Matlab: D = imdilate(I,SE)
![Page 20: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/20.jpg)
⊕ Dilation - problem
![Page 21: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/21.jpg)
⊕ Dilation - result
![Page 22: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/22.jpg)
⊕ Dilation - Typical applications
Dilation
Filling of holes of certain shape and size, given by SE
![Page 23: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/23.jpg)
⊕ Dilation - properties
1 It is increasing, i.e., if A ⊂ C , then A⊕ B ⊂ C ⊕ B
2 If the origin belongs to the structuring element B , then it is extensiveA ⊂ A⊕ B
3 It is distributive over set union, i.e.,(A1 ∪ A2)⊕ B = (A1 ⊕ B) ∪ (A2 ⊕ B)
4 It is translation invariant
![Page 24: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/24.jpg)
Erosion - Dilation dualityErosion and dilation are dual with respect to complementation andreflection
(A⊖ B)C = AC ⊕ B
(a) A (b) A⊖ B (c) (A⊖ B)C
(d) AC (e) A
C⊕ B
![Page 25: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/25.jpg)
How to choose appropriate SE?
Different structuring elements give different results
Depend on previous knowledge
Linear structuring elements for linear structures
Circular structuring elements for circular structures
![Page 26: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/26.jpg)
Opening and closing
Combine erosion and dilation using the same SE
◦ OpeningMatlab: O = imopen(I,SE)
• ClosingMatlab: C = imclose(I,SE)
![Page 27: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/27.jpg)
Opening
Erosion followed bydilation
A ◦ B = (A⊖ B)⊕ B
Eliminates protrusionsBreaks connectionsSmooths contour
![Page 28: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/28.jpg)
Opening (first erosion)
![Page 29: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/29.jpg)
Opening (then dilation)
![Page 30: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/30.jpg)
◦ Opening - properties
1 It is idempotent, i.e., (A ◦ B) ◦ B = A ◦ B2 It is increasing, i.e., if A ⊂ C , then A ◦ B ⊂ C ◦ B3 It is anti-extensive, i.e., A ◦ B ⊂ A
4 It is translation invariant
![Page 31: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/31.jpg)
Closing
Dilation followed byerosion
A • B = (A⊕ B)⊖ B
Smooths contourFuses narrow breaksand long thin gulfsEliminates small holesFills gaps in thecontour
![Page 32: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/32.jpg)
Closing (first dilation)
![Page 33: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/33.jpg)
Closing (then erosion)
![Page 34: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/34.jpg)
• Closing - properties
1 It is idempotent, i.e., (A • B) • B = A • B2 It is increasing, i.e., if A ⊆ C , then A • B ⊆ C • B3 It is extensive, i.e., A ⊆ A • B4 It is translation invariant
![Page 35: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/35.jpg)
Opening - Closing duality
Opening and closing are dual operators A • B = (Ac ◦ B)cOpening (roll ball inside of the object)Boundary of A ◦ B is equal to points in B that reaches closest to theboundary of A, when B is rolled inside A
Closing (roll ball outside of the object)Boundary of A • B is equal to points in B that reaches closest to theboundary of A, when B is rolled outside A
![Page 36: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/36.jpg)
Exercise 1Find erosion, dilation, opening and closing for the given image and SE
![Page 37: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/37.jpg)
Exercise 2Find erosion, dilation, opening and closing for the given image and SE
![Page 38: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/38.jpg)
⊗ Hit-or-miss transformation
Transformation that involves two structuring elements
First has to fit with the object while, simultaneously, the second hasto fit the background
First has to hit the object while, simultaneously, second has to miss it
A⊗ B = (A⊖ B1) ∩ (AC ⊖ B2)
Composite SE B = (B1,B2): Object part (B1) and background (B2)
![Page 39: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/39.jpg)
Hit-or-miss transformation (⊗ or HMT)
Alternative:A⊗ B = (A⊖ B1) ∩ (AC ⊖ B2)
= (A⊖ B1) ∩ (A⊕ B2)C
= (A⊖ B1) \ (A⊕ B2)
B1 and B2 share the same origin and are disjoint sets
![Page 40: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/40.jpg)
Applications of mathematical morphology
More in the course book: Chapter 9.5
Boundary extraction β(A) = A \ (A⊖ B)
Boundary extraction β(A) = (A ⊕ B) \ A
![Page 41: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/41.jpg)
Part 2
Distance Transforms
![Page 42: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/42.jpg)
Distance transforms
Input: Binary image.Output: In each object (background) pixel, write the distance to theclosest background (object) pixel.
Definition
A function d is a metric (distance measure) for the pixels x , y , and z if
(i) d(x , y) ≥ 0
(ii) d(x , y) = 0 iff x = y
(iii) d(x , y) = d(y , x)
(iv) d(x , y) ≤ d(x , z) + d(z , y)
![Page 43: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/43.jpg)
Different metrics
Minkowski distances
Euclidean dE (p, q) =√
(xp − xq)2 + (yp − yq)2
City block d4(p, q) = |xp − xq|+ |yp − yq|Chess-board d8(p, q) = max(|xp − xq|, |yp − yq|)where p = (xp , yp) and q = (xq, yq).
![Page 44: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/44.jpg)
Different mask for distance transforms
Minkowski distances
Euclidean mask:√2 1
√2
1 p
City block mask:2 1 2
1 p
Chess-board mask:1 1 1
1 p
Weighted measures
4 3 4
3 p
If distance between two 4-connected pixels is 3, then thedistance between 4-connected pixels should be 4.Chamfer〈3, 4〉 since 4/3 ≈ 1.33 is close to
√2.
Matlab
DT = bwdist(I,method)
![Page 45: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/45.jpg)
Algorithm for distance transformationDistance from each object pixel to the closest background pixel
p current pixelg1 − g4 neighbouring pixelsw1 − w4 weights (according to choice of metric)
1. Set background pixels to zero and object pixels to infinity.2. Forward pass, from (0, 0) to (max(x),max(y)):
if p > 0, p = min(gi + wi ), i = 1, 2, 3, 4.
3. Backward pass, from (max(x),max(y)) to (0, 0):If p > 0, p = min(p, min(gi + wi )), i = 1, 2, 3, 4.
![Page 46: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/46.jpg)
Chamfer 〈3, 4〉 distanceBinary original image
0 0 0 0 0 0 0 0
0 1 0 0 1 0 0 0
0 1 1 0 1 0 0 0
0 1 1 1 1 1 1 0
0 1 1 1 1 1 1 0
0 1 1 1 1 1 1 0
0 0 0 1 1 1 0 0
0 0 0 0 0 0 0 0
![Page 47: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/47.jpg)
Chamfer 〈3, 4〉 distance1. Starting image
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
4 3 4
3 p
![Page 48: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/48.jpg)
Chamfer 〈3, 4〉 distance2. First pass from top left down to bottom right
0 0 0 0 0 0 0 0
0 3 0 0 3 0 0 0
0 3 3 0 3 0 0 0
0 3 4 3 4 3 3 0
0 3 6 6 7 6 4 0
0 3 6 9 10 8 4 0
0 0 0 3 6 8 0 0
0 0 0 0 0 0 0 0
p 3
4 3 4
![Page 49: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/49.jpg)
Chamfer 〈3, 4〉 distance3. Second pass from bottom right down to top left
0 0 0 0 0 0 0 0
0 3 0 0 3 0 0 0
0 3 3 0 3 0 0 0
0 3 4 3 4 3 3 0
0 3 6 6 7 6 3 0
0 3 3 4 6 4 3 0
0 0 0 3 3 3 0 0
0 0 0 0 0 0 0 0
![Page 50: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/50.jpg)
Applications using the distance transform (DT)
I. Find the shortest path between two points a and b.1 Generate the DT with a as the object.2 Go from b in the steepest gradient direction.
II. Find the radius of a round object1 Generate the DT of the object.2 The maximum value equals the radius.
• Next lecture and Lab 2: watershed algorithm!
![Page 51: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/51.jpg)
Applications using the distance transform (DT)
III . Skeletons
Definitions: If O is the object, B isthe background, and S is the skeleton,thenS is topological equivalent to OS is centered in OS is one pixel wide (difficult!)O can be reconstructed from S
Matlab
SK = bwmorph(I,operation)
![Page 52: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/52.jpg)
Skeletons (Centers of Maximal Discs)
A disc is made of all pixels that are within a given radius r . A disc in anobject is maximal if it is not covered by any other disc in the object. Areversible representation of an object is the set of centers of maximal discs.
Algorithm
Find the skeleton with Centers of Maximal Discs (CMD)Completely reversible situation
1 Generate distance transform of object
2 Identify CMDs (smallest set of maxima)
3 Link CMDs
“Pruning” is to remove small branches (no longer fully reversible.)
![Page 53: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/53.jpg)
Topic not covered in this lecture
Mathematical morphology for gray-valued image (Image Analysis 2)
Morphological Skeletons
Number of applications of mathematical morphology and distancetransform (Lab 2)
![Page 54: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/54.jpg)
Trends in mathematical morphology-
possible topics for master thesis
Adaptive mathematical morphology
Nonlocal mathematical morphology
Multi-valued mathematical morphology
Efficient GPU implementations
![Page 55: Mathematical Morphology and Distance TransformsThe language of mathematical morphology is set theory We will mostly work in Z2 Easy to extend to Zn Can be extended to a continuous](https://reader030.fdocuments.in/reader030/viewer/2022040619/5f2c629465e876540c6e71be/html5/thumbnails/55.jpg)
Exercise
Reading material: Chapters 9.1 - 9.6
Two problem given during the lecture (OBS! non-symmetric SE)
Book: Exercise 9.3, 9.5, 9.7, 9.14, 9.19