[go: up one dir, main page]

0% found this document useful (0 votes)
76 views32 pages

Lecture 10

Uploaded by

owennene0909
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views32 pages

Lecture 10

Uploaded by

owennene0909
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

Digital Image Processing - COMP4173

Lecture 10: Morphological Image Processing

Prof. Hongjian Shi (时红建)


Department of Computer Science and Technology
BNU-HKBU United International University
Email: shihj@uic.edu.cn
Office: T3-601-R3;
Office Hours: Tues., Wed., Thur. 9:00-11:50; Wed. 16:00-16:50
1
Notions and Purpose
• The word mathematical morphology refers to the scientific branch
that deals the forms and structures of humans/animals/plants
• Morphology in image processing is a tool for distinguishing
meaningful shape info from irrelevant ones and extracting image
components that are useful in the representation and description of
region shape, such as boundaries and skeletons
• The morphological operations can be used for filtering, thinning
and pruning objects inside a binary or grayscale image
• The language of the Morphology comes from the set theory, where
image objects can be represented by sets. For example, an image
object containing black2 pixels can be considered a set of black
pixels in 2D space of 𝑍 in a binary image. The set of pixels with
gray values can be considered as an object in an image
Set Theory Fundamentals
• A is a set in 𝑍 2 and 𝑎 = (𝑎1 , 𝑎2 ), then a is an element in A: 𝑎 ∈ 𝐴;
a is not an element in A: 𝑎 ∉ 𝐴
• Two sets A and B, A is said to be the subset of B: 𝐴 ⊆ 𝐵
• The union of A and B is denoted by: 𝐶 = 𝐴 ∪ 𝐵
• The intersection of A and B is denoted by: 𝐷 = 𝐴 ∩ 𝐵
• Two sets are disjoint/mutually exclusive if 𝐴 ∩ 𝐵 = ∅
• The complement of set A is the set of elements not contained in A:
𝐴𝑐 = 𝜔 𝜔 ∉ A
• The difference of two sets: 𝐴 − 𝐵 = {𝜔|𝜔 ∈ 𝐴, 𝜔 ∉ 𝐵}
Set Theory Fundamentals
• The translation of a set A by a
point 𝑧 = 𝑧1 , 𝑧2 is defined as:

• The reflection of a set B is defined


as:
Logic Operations
on Binary Images
Structuring Elements
• Structural elements are small sets or subimages used to probe an
image for interesting properties
Erosion and Dilation -
Erosion
• The erosion of
a set A by a
structural
element B is
defined as the
set of all points
𝑧 such that
𝐵, translated
by 𝑧 is still
contained in A:

𝐴 ⊝ 𝐵 ⊂ 𝐴?
• When you perform erosion, one needs to pad the object and
the structuring element to rectangular arrays
• During erosion process, the structuring element erodes the input image A
at its boundaries. So, erosion shrinks the input image
Image details smaller than the structuring elements removed
Erosion and Dilation - Dilation
• The dilation of a set A by a structuring element B is defined as:

• Of course 𝐴 ⊆ A ⊕ 𝐵, the dilation expands/dilutes the image


• Dilation operation grows or thickens objects in a binary image,
that is, increasing the boundary thickness by half side of the
structuring element
• So, dilation and erosion are opposite operation, dilation is the
thickening process and erosion is the thinning process
The dilation operation bridges gaps and is a nonlinear process same as
the erosion process, it is better than the lowpass filter
Opening and Closing
• From the names, we can see that these operations open and close
boundaries as they indicate.
• Opening is a process of erosion followed by dilation. It has the
effect to eliminate small and thin object, breaking the object at
thin points and smoothing the boundaries of the objects. The
operation is defined as:

• Closing is a process of dilation followed by erosion. It has the


effect of filling small and thin holes, connecting nearby objects
and smoothing the boundaries of the objects.
Properties of Opening and Closing
Hit-or-Miss Transform (Template Matching)
• Hit-or-miss transform can be used for shape detection / template
matching
• Given the shape as the structuring element 𝐵1 , the hit-or-miss
transform is defined as (morphological hit-or-miss transform):

• Where 𝐵2 = 𝑊 − 𝐷 and 𝐵1 = 𝐷. W is the window enclosing 𝐵1 .

Shape we are searching for


One pixel background is
needed for exact match (hit)

Find a match (hit)of D


in A

≠ ∅?

𝐵1 = 𝐷, 𝐵2 = 𝑊 − 𝐷
Basic Morphological Algorithms
• On binary images, we can extract image shape components. In image
pre- or post- processing, we can perform object boundary extraction
(edge detection), skeleton of a region for region filing, thinning,
thickening, and pruning.
• Boundary extraction: the boundary of a set A denoted by 𝛽(𝐴) can be
obtained by:
• Structural element size is 3x3. In general, structural element size 𝑑 × 𝑑 (𝑑 ≥ 3)
• For binary images, 1 denotes white, 0 denote black. Structural element are
treated as white.
• Boundaries are thicker if the structural element size is larger
Region Filing
• Dilation would fill the region where its intersection with 𝐴𝑐 ≠ ∅.
We want to fill the holes (not contained in A) inside an object in
an image. We need to have a structural element B, an initial non-
boundary set of pixels 𝑋0 (close the region), try to add the
intersection points of the dilation and 𝐴𝑐
• Region filing process:
• 𝑋0 is the initial non-boundary set, B is the structural element
• While 𝑋𝑘 ≠ 𝑋𝑘−1 do
𝑋𝑘 = (𝑋𝑘−1 ⊕ 𝐵) ∩ 𝐴𝑐 Conditional dilation
𝐹 𝐴 = 𝑋𝑘 ∪ 𝐴
Extraction of Connected Components
• 𝑋0 = 1 corresponds to
one of the pixels on the
component Y. Note that
one of the pixel
locations on the
component must be
known.
• Consecutive dilations and
their intersection
with A, yields all elements
of component Y

while 𝑋𝑘 ≠ 𝑋𝑘−1 do
𝑋𝑘 = (𝑋𝑘−1 ⊕ 𝐵) ∩ 𝐴
𝑌 = 𝑋𝑘
Thinning
Hit-or-miss operation

• A useful expression for thinning symmetrically is based on a


sequence of structuring elements: , where 𝐵𝑖
is a rotated version of 𝐵𝑖−1 . Thinning by a sequence of structuring
elements is defined as:

• If there are 4 structuring elements, thinning is performed from 4


directions separated by 90°. If thinning is performed by 8
structuring elements, 8 directions separated by 45° will be used.
• The thinning process is to thin A by one pass at one time. It will
make the object smaller. For edge images, it makes edges thinner
Thickening
• Thickening by a sequence of structuring elements
is defined as:
• The thickening process removes disconnected points

You might also like