(IP'22) Lecture 6 - Segmentation II - Morphology
(IP'22) Lecture 6 - Segmentation II - Morphology
Digital Image
Processing
11/21/2022 2
Region-based Segmentation
Basic Formulation
• Partition image region 𝑹 into subregions such that:
Motion
Detection
Wavelet-
Background Frame Optical Flow
based
Subtraction Differencing Techniques
Techniques
Segmentation Methods (some)
Image Segmentation
• Graph cuts
• Graph-based • Interactive
• Color • Sports
• Active Contours • Medical images
• Mean shift • Surveillance
• Matting • Videos
• Machine learning • Infrared
• etc. • etc.
Examples
Richard Szeliski, Computer Vision Algorithms and Applications, Springer 2010. (Chapter 5)
Examples
(a) the energy function is encoded as a maximum flow problem; (b) the minimum cut determines the
region boundary
Richard Szeliski, Computer Vision Algorithms and Applications, Springer 2010. (Chapter 5)
Examples
(a) directed graph; (b) image with seed points; (c) the undirected graph incorrectly continues
the boundary along the bright object; (d) the directed graph correctly segments the light gray
region from its darker surround.
Richard Szeliski, Computer Vision Algorithms and Applications, Springer 2010. (Chapter 5)
Examples – (cont.)
Morphological
Image Processing
Fundamental Steps of DIP
Wavelet and
Multi- Compression
resolution
Output is generally images
Knowledge base
Restoration Segmentation
Representation
Enhancement and
Description
Object
Acquisition Recognition
Problem Domain
Contents
1. What is Morphology?
2. Fundamentals
3. Basic Morphological Operations
4. Compound Operations
5. Basic Morphological Algorithms
What is Morphology?
Mathematical morphology
• Morphological image processing describes a
range of image processing techniques that
deal with the shape of features in an image.
• Hence, used in image analysis based on
shape.
• Nonlinear operations that are based on
Minkowski’s set theory.
What is Morphology? – (cont.)
• Used to extract image components that are
useful in the representation and description
of regions shapes.
• Can be used to remove imperfections in the
segmented image and provide information
on the form and structure of the image.
• Pre- or post-processing.
What is Morphology? – (cont.)
Uses of Image Morphology
• image enhancement • shape analysis
• image segmentation • image compression
• image restoration • component analysis
• edge detection • curve filling
• texture analysis
• general thinning
• particle analysis
• feature detection
• feature generation
• skeletonization • noise reduction
What is Morphology? – (cont.)
Examples
0 0 1 0 0
1 1 1 0 1 0 0 1 1 1 0
1 1 1 1 1 1 1 1 1 1 1
1 1 1 0 1 0 0 1 1 1 0
0 0 1 0 0
Fundamentals – (cont.)
Structuring Element
Fundamentals – (cont.)
Structuring Element – Hits and Fits
SE
SE
B SE
B SE
0 0 1 1 1 1 1 1 0 0 0 0 0 1 0
0 0 1 1 1 1 1 1 1 0 0 0 1 1 1
0 0 1 1 1 1 1 1 1 1 1 0 0 1 0
0 0 0 0 0 1 1 1 1 1 1 0 Structuring
Element 2
0 0 0 0 0 0 0 0 0 0 0 0
Fundamentals – (cont.)
Structuring Element – Hits and Fits
0 0 0 0 0 0 0 0 0 0 0 0
1 1 1
0 0 0 1 1 0 0 0 0 0 0 0
1 1 1
0 0 1 1 1 1 1 0 0 0 0 0
1 1 1
0 1 1 1 1 1 1 1 0 0 0 0 Structuring
0 1 1 1 1 1 1 1 0 0 0 0 Element 1
0 0 1 1 1 1 1 1 0 0 0 0 0 1 0
0 0 1 1 1 1 1 1 1 0 0 0 1 1 1
0 0 1 1 1 1 1 A1 1 1 1 0 0 1 0
0 0 0 0 0 1 1 1 1 1 1 0 Structuring
Element 2
0 0 0 0 0 0 0 0 0 0 0 0
Fundamentals – (cont.)
Structuring Element – Hits and Fits
0 0 0 0 0 0 0 0 0 0 0 0
1 1 1
0 0 0 1 1 0 0 0 0 0 0 0
1 1 1
0 0 1 B1 1 1 1 0 0 0 0 0
1 1 1
0 1 1 1 1 1 1 1 0 0 0 0 Structuring
0 1 1 1 1 1 1 1 0 0 0 0 Element 1
0 0 1 1 1 1 1 1 0 0 0 0 0 1 0
0 0 1 1 1 1 1 1 1 0 0 0 1 1 1
0 0 1 1 1 1 1 A1 1 1 1 0 0 1 0
0 0 0 0 0 1 1 1 1 1 1 0 Structuring
Element 2
0 0 0 0 0 0 0 0 0 0 0 0
Fundamentals – (cont.)
Structuring Element – Hits and Fits
0 0 0 0 0 0 0 0 0 0 0 0
1 1 1
0 0 0 1 1 0 0 0 0 0 0 0
1 1 1
0 0 1 B1 1 1 1 0 C0 0 0 0
1 1 1
0 1 1 1 1 1 1 1 0 0 0 0 Structuring
0 1 1 1 1 1 1 1 0 0 0 0 Element 1
0 0 1 1 1 1 1 1 0 0 0 0 0 1 0
0 0 1 1 1 1 1 1 1 0 0 0 1 1 1
0 0 1 1 1 1 1 A1 1 1 1 0 0 1 0
0 0 0 0 0 1 1 1 1 1 1 0 Structuring
Element 2
0 0 0 0 0 0 0 0 0 0 0 0
Fundamentals – (cont.)
Structuring Element – Reflected/Translated
• The reflection of set B, denoted by B̂ , is
defined as: Bˆ = z | z = −b, for b B
Structuring Element
Erosion – (cont.)
Original Image Processed Image With Eroded Pixels
Structuring Element
Erosion – (cont.)
Original Image Processed Image With Eroded Pixels
Structuring Element
Erosion – (cont.)
Original Image Processed Image With Eroded Pixels
Structuring Element
Erosion – (cont.)
Original Image Processed Image With Eroded Pixels
Structuring Element
Erosion – (cont.)
Original Image Processed Image With Eroded Pixels
Structuring Element
Erosion – (cont.)
Original Image Processed Image With Eroded Pixels
Structuring Element
Erosion – (cont.)
Original Image Processed Image With Eroded Pixels
Structuring Element
Erosion – (cont.)
Original Image Processed Image With Eroded Pixels
Structuring Element
Erosion – (cont.)
Original Image Processed Image With Eroded Pixels
Structuring Element
Erosion – (cont.)
Original Image Processed Image With Eroded Pixels
Structuring Element
Erosion – (cont.)
Original Image Processed Image With Eroded Pixels
Structuring Element
Erosion – (cont.)
Original Image Processed Image With Eroded Pixels
Structuring Element
Erosion – (cont.)
Original Image Processed Image With Eroded Pixels
Structuring Element
Erosion – (cont.)
Original Image Processed Image With Eroded Pixels
Structuring Element
Erosion – (cont.)
Structuring
Element
Structuring Element
Dilation – (cont.)
Structuring element
Dilation – (cont.)
Dilation can repair breaks
Structuring
Element
Structuring Element
Opening – (cont.)
Structuring
Element
Structuring Element
Closing – (cont.)
Structuring
Element
closing dilation
original
original
SE = Z8
opening erosion 1using the reflected SE, Ž
Examples
Erosion
Examples – (cont.)
Erosion
Examples – (cont.)
Erosion
Examples – (cont.)
Dilation
Examples – (cont.)
Dilation
Examples – (cont.)
Dilation
Examples – (cont.)
The erosion of the dark-blue square by The dilation of the dark-blue square by a
a disk, resulting in the light-blue square disk, resulting in the light-blue square
with rounded corners
Examples – (cont.)
Dilation:
- Object thickens
- Intrusions reduce in size
if survived
- Protrusions increase in
size if survived
- Outer corners round
(Disk SE).
Examples – (cont.)
Examples – (cont.)
Opening:
- Outward pointing
corners → rounded
- Inward pointing corners
→ unchanged if survived
- Smoothing effect
Examples – (cont.)
Examples – (cont.)
Closing:
- Inward pointing corners
→ rounded
- Outward pointing corners
→ unchanged
- Intrusions reduces/breaks
if B doesn’t fit
- Smoothing effect
Examples – (cont.)
Examples – (cont.)
Erosion:
- Object shrinks by SE size
- Protrusions where B didn’t
fit were eliminated
Some Basic Morphological Algorithms
• Using the simple techniques we have looked
at so far we can begin to consider some more
interesting morphological algorithms:
– Hit-or-miss transform - Top-Hat
– Boundary Extraction - Hole Filling
– Connected components - Convex Hull
– Thinning/thickening - Skeletonziation
– Pruning
Top-Hat Transform
• Top-hat transformation of an image X is
defined as the difference between the
original image X and its opening
• TH = X - (X ○ SE)
X X ○ SE Top Hat
dilated
tag tag
masked
dilated tags
tag
masked
dilated
dilated
tags
tags
Connected Components Extraction
dilated
tags tags
masked dilated
tags tags
masked
connected
dilated
component
tags
Connected Components Extraction
• Automated inspection of processed food
• X-ray image of chicken filet.
• Identify bone fragments.
Connected Components Extraction
• Automated inspection of processed food
• X-ray image of chicken filet.
• Identify bone fragments.
1. Thresholded image
Connected Components Extraction
• Automated inspection of processed food
• X-ray image of chicken filet.
• Identify bone fragments.
1. Thresholded image
2. Eroded image (size?)
Connected Components Extraction
• Automated inspection of processed food
• X-ray image of chicken filet.
• Identify bone fragments.
1. Thresholded image
2. Eroded image (size?)
3. Size of connected component
Helpful Reading
• Convex Hull • MR: morphological
• Thinning/Thickening reconstruction
• Sekeletonization
• Pruning
Gray Scale Morphology
Basic Operations
Gray Scale Morphology – (cont.)
Dilation
Assignment
Check book sections and associated problems
Chapter 9 1, 2, 3, 5(1,2,3)
11/21/2022 134
References
- Gonzalez and Woods, Digital Image Processing.
- Peters, Richard Alan, II, “Image Morphology", Lectures on Image Processing,
Vanderbilt University, Nashville, TN, April 2008, Available on the web at the Internet
Archive, http://www.archive.org/details/Lectures_on_Image_Processing.
-Yuliya Tarabalka, Jón Atli Benediktsson, Jocelyn Chanussot, “Mathematical
morphology”, presentation, University of Iceland/Grenoble Institute of Technology,
France.
- Qigong Zheng, “Mathematical Morphology”, University of Maryland College Park.
11/21/2022 135