Image Processing and Analysis (ImagePandA) 7 – Morphological Image Processing Christoph Lampert / Chris Wojtan Based on content from “Digital Image Processing” by Gonzalez and Woods TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.:
Outline Preliminaries Erosion and Dilation Opening and Closing The Hit-or-Miss Transformation Some Basic Morphological Algorithms Gray-Scale Morphology
Outline Preliminaries Erosion and Dilation Opening and Closing The Hit-or-Miss Transformation Some Basic Morphological Algorithms Gray-Scale Morphology
Preliminaries Set theory 𝐵 = 𝑤 𝑤=−𝑏, for 𝑏∈𝐵 Reflection 𝐵 𝑧 = 𝑐 𝑐=𝑏+𝑧, for 𝑏∈𝐵 Translation
Preliminaries Set theory Structuring elements (SEs) Small sets or subimages used to probe an image SEs are padded to rectangular images
Outline Preliminaries Erosion and Dilation Opening and Closing The Hit-or-Miss Transformation Some Basic Morphological Algorithms Gray-Scale Morphology
Erosion and Dilation Erosion 𝐴⊖𝐵={𝑧| 𝐵 𝑧 ⊆𝐴} 𝐴⊖𝐵={𝑧| 𝐵 𝑧 ∩ 𝐴 𝑐 =∅}
Erosion and Dilation Erosion 𝐴⊖𝐵={𝑧| 𝐵 𝑧 ⊆𝐴} 𝐴⊖𝐵={𝑧| 𝐵 𝑧 ∩ 𝐴 𝑐 =∅}
Erosion and Dilation Erosion 𝐴⊖𝐵={𝑧| 𝐵 𝑧 ⊆𝐴} 𝐴⊖𝐵={𝑧| 𝐵 𝑧 ∩ 𝐴 𝑐 =∅}
Erosion and Dilation 𝐴⊕𝐵={𝑧| 𝐵 𝑧 ∩𝐴≠∅} Dilation
Erosion and Dilation 𝐴⊕𝐵={𝑧| 𝐵 𝑧 ∩𝐴≠∅} Dilation
Erosion and Dilation Duality Erosion is just like dilating the compliment Dilation is just like eroding the compliment (𝐴⊖𝐵) 𝑐 = 𝐴 𝑐 ⊕ 𝐵 (𝐴⊕𝐵) 𝑐 = 𝐴 𝑐 ⊖ 𝐵
Outline Preliminaries Erosion and Dilation Opening and Closing The Hit-or-Miss Transformation Some Basic Morphological Algorithms Gray-Scale Morphology
Opening and Closing Opening A∘𝐵= 𝐴⊖𝐵 ⊕𝐵 Closing A∘𝐵= 𝐴⊕𝐵 ⊖𝐵
Opening and Closing Opening A∘𝐵= 𝐴⊖𝐵 ⊕𝐵 Closing A∘𝐵= 𝐴⊕𝐵 ⊖𝐵
Opening and Closing
Opening and Closing
Outline Preliminaries Erosion and Dilation Opening and Closing The Hit-or-Miss Transformation Some Basic Morphological Algorithms Gray-Scale Morphology
The Hit-or-Miss Transformation Given disjoint structuring elements 𝐶 and 𝐷 𝐴⊛𝐵= 𝐴⊖𝐶 ∩( 𝐴 𝑐 ⊖𝐷) Point 𝑧 belongs to the hit-or-miss transform output if: 𝐶 translated to 𝑧 fits in 𝐴, and 𝐷 translated to 𝑧 misses 𝐴 (fits the background of 𝐴) Result is the set of positions where the first structuring element fits in the foreground of the input image, and the second structuring element misses it completely. It is used to detect patterns or shapes
The Hit-or-Miss Transformation
Outline Preliminaries Erosion and Dilation Opening and Closing The Hit-or-Miss Transformation Some Basic Morphological Algorithms Gray-Scale Morphology
Boundary Extraction 𝛽 𝐴 =𝐴−(𝐴⊖𝐵)
Boundary Extraction 𝛽 𝐴 =𝐴−(𝐴⊖𝐵)
Hole Filling Pick a pixel inside of a hole, call it 𝑋 0 Iterate 𝑋 𝑘 =( 𝑋 𝑘−1 ⊕𝐵)∩ 𝐴 𝑐
Hole Filling Pick a pixel inside of a hole, call it 𝑋 0 Iterate 𝑋 𝑘 =( 𝑋 𝑘−1 ⊕𝐵)∩ 𝐴 𝑐
Extracting Connected Components Pick a pixel inside of a shape, call it 𝑋 0 Iterate 𝑋 𝑘 =( 𝑋 𝑘−1 ⊕𝐵)∩𝐴
Thinning 𝐴⊗𝐵=𝐴− 𝐴⊛𝐵 =𝐴∩ (𝐴⊛𝐵) 𝑐 Repeat until no change
Thickening Morphological dual of thinning 𝐴⊙𝐵=𝐴∪ 𝐴⊛𝐵 Repeat until no change More common approach: Thin the background 𝐴 𝑐 and then compliment the result
Thickening
Pruning
Geodesic Dilation
Geodesic Erosion
Morphological Reconstruction
Morphological Reconstruction
Border clearing Find all boundary pixels in A Morphologically reconstruct all of them Subtract those from the original
Border clearing
Outline Preliminaries Erosion and Dilation Opening and Closing The Hit-or-Miss Transformation Some Basic Morphological Algorithms Gray-Scale Morphology
Gray-Scale Morphology
Gray-Scale Morphology Erosion 𝑓⊖𝑏 𝑥,𝑦 = min 𝑠,𝑡 ∈𝑏 𝑓(𝑥+𝑠,𝑦+𝑡) Dilation 𝑓⨁𝑏 𝑥,𝑦 = max 𝑠,𝑡 ∈𝑏 𝑓(𝑥−𝑠,𝑦−𝑡)
Gray-Scale Morphology
Gray-Scale Morphology Erosion 𝑓⊖𝑏 𝑥,𝑦 = min 𝑠,𝑡 ∈𝑏 𝑓(𝑥+𝑠,𝑦+𝑡) Dilation 𝑓⨁𝑏 𝑥,𝑦 = max 𝑠,𝑡 ∈𝑏 𝑓(𝑥−𝑠,𝑦−𝑡) Opening f∘𝑏= 𝑓⊖𝑏 ⊕𝑏 Closing f∘𝑏= 𝑓⊕𝑏 ⊖𝑏
Gray-Scale Morphology
Gray-Scale Morphology
Gray-Scale Morphology
Gray-Scale Morphology Mostly analogous to binary morphology Lots of potential, but lots of heuristics/hacks Not easy to find general tricks that work on all problems
Gray-Scale Morphology