Download as pdf or txt
Download as pdf or txt
You are on page 1of 25

Morphological Image Processing

Anoop M. Namboodiri
anoop@iiit.ac.in
Morphological Operations
• Neighbourhood operations carried out in
spatial domain
• Based on mathematical morphology
• set theoretical framework
• originally for binary images
• extended for grey scale images
• Applications:
• extract info about forms and structures
• shaping and filtering of forms and structures

DIP: Monsoon 2003


Morphological Processing
• Consists essentially of two steps:
• Probe a given object in x[m,n] with a structuring
element (se)
• Find how the se fits with the object
• Information about fit is used to
• extract info about the form of object; OR
• change pixel values and shape objects
• Different size & shape of se yields different kinds
of info about the object; shapes the regions in
different ways

DIP: Monsoon 2003


Set Theory Basics
• Union, Intersection
• Complement, Difference
• Subset, Superset, Disjoint Sets

• Reflection: Bˆ = {w | w = −b, for b ∈ B}

• Translation: ( A) z = {c | c = a + z, for a ∈ A}

DIP: Monsoon 2003


Examples
B A

(0,0)

(A)z | z = (3,5) -A
A-B

(3,5) (0,0)

DIP: Monsoon 2003


Morphological Operations/Algorithms
• Basic Morphological Operations
• Dilation
• Erosion
• Opening
• Closing
• Hit-or-Miss Transformation
• Morphological Algorithms
• Extensions to Grayscale

DIP: Monsoon 2003


Dilation
• Dilation of A by B: A⊕B

A ⊕ B = {z | ( Bˆ ) z ∩ A ≠ Φ} A ⊕ B = {z | [( Bˆ ) z ∩ A] ⊆ A}

A A⊕B
x x

x
B
x x


x

DIP: Monsoon 2003


Dilation: Example

DIP: Monsoon 2003


Dilation: Example
0 1 0

1 1 1

0 1 0

DIP: Monsoon 2003


Erosion
• Erosion of A by B: A B

A B = {z | (B)z ⊆ A}.

A A⊕B

x
B
x x

DIP: Monsoon 2003


Erosion: Example

DIP: Monsoon 2003


Erosion + Dilation

DIP: Monsoon 2003


Opening and Closing
• Opening: Erosion followed by Dilation
• Opening A by B: A ○ B = (A B) ⊕ B
• Smoothes Contours, Breaks narrow bridges,
Eliminates thin protrusions

• Closing: Dilation followed by Erosion


• Closing A by B: A ● B = (A ⊕ B) B
• Smoothing, Closes small holes and channels

DIP: Monsoon 2003


Opening: Physical Interpretation

DIP: Monsoon 2003


Closing: Physical Interpretation

DIP: Monsoon 2003


Opening: Example

.
B

Erosion Dilation

DIP: Monsoon 2003


Closing: Example

.
B

Dilation Erosion

DIP: Monsoon 2003


1 1 1

Example 1
1
1
1
1
1

DIP: Monsoon 2003


Interesting Points
• A ○ B is a subset of A.
• If C ⊆ D; then C ○ B ⊆ D ○ B.
• (A ○ B) ○ B = A ○ B.
• A is a subset of A ● B.
• If C ⊆ D; then C ● B ⊆ D ● B.
• (A ● B) ● B = A ● B.

DIP: Monsoon 2003


Hit-or-Miss Transform (HMT)
• To detect an object in an image:
• Basic Idea:
• Use the object as se for erosion of A and
detect possible fits.
• Use the neighborhood of the object as
se for erosion of Ac and find over fits.
• Combine the two to detect exact fits.

DIP: Monsoon 2003


HMT: Example

DIP: Monsoon 2003


Morphological Algorithms
• Boundary Extraction
• Region Filling
• Connected Components
• Convex Hull
• Thinning
• Thickening
• Skeletonization
• Pruning

DIP: Monsoon 2003


Boundary Extraction
• Boundary of A is computed as:
β(A) = A - (A B)

DIP: Monsoon 2003


Boundary Extraction: Example

DIP: Monsoon 2003


Region Filling
• Fills a regions, whose boundary is given as
8-connected neighbours:
Xk = (Xk-1 ⊕ B) ∩ Ac, k = 1, 2, 3,…

DIP: Monsoon 2003

You might also like