0% found this document useful (0 votes)
4 views

Image Processing 5

Chapter 5 introduces morphological image processing, focusing on techniques that analyze the shape of features in binary images. Key operations include dilation and erosion, which manipulate images using a structuring element to either enlarge or shrink objects, respectively. The chapter also discusses compound operations like opening and closing, which combine these basic operations to achieve specific effects in image processing.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Image Processing 5

Chapter 5 introduces morphological image processing, focusing on techniques that analyze the shape of features in binary images. Key operations include dilation and erosion, which manipulate images using a structuring element to either enlarge or shrink objects, respectively. The chapter also discusses compound operations like opening and closing, which combine these basic operations to achieve specific effects in image processing.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 50

CHAPTER 5

Introduction to
Morphological
Image Processing
Bal Krishna Subedi
CDCSIT, TU
Contents
 LogicOperations involving binary images, Dilation and
Erosion, Opening and Closing LH
2
What Is Morphology?
 Morphological image processing (or morphology) describes
a range of image processing techniques that deal with the
shape (or morphology) of features in an image
 Morphological operations are typically applied to remove
imperfections introduced during segmentation, and so
typically operate on bi-level images
 Morphological techniques probe an image with a small shape
or template called a structuring element.
 The structuring element is positioned at all possible locations
in the image and it is compared with the corresponding
neighbourhood of pixels. Some operations test whether the
element "fits" within the neighbourhood, while others test
whether it "hits" or intersects the neighbourhood.
 The word morphology commonly denotes a branch of
biology that deals with the form and structure of animals
and plants.
 Mathematical morphology is a tool that extract image
components that are useful in the representation and
description of region shape.
 Set theory is usually used to describe mathematical
morphology.
 Sets represent objects in a binary image.
Quick Example

Image after segmentation Image after segmentation and


morphological processing
Some Basic Concepts from Set
Theory
Some Basic Concepts from Set
Theory
Some Basic Concepts from Set
Theory
Logic Operations involving
binary images
Logic Operations involving
binary images
Logic Operations involving
binary images
Logic Operations involving
binary images
Structuring Elements, Hits & Fits

B Structuring Element

Fit: All on pixels in the


structuring element cover on
pixels in the image
Hit: Any on pixel in the
A structuring element covers an on
C pixel in the image

All morphological processing operations


are based on these simple ideas
Structuring Elements
Structuring elements can be any size and make
any shape
However, for simplicity we will use rectangular
structuring elements with their origin at the
middle pixel
The structuring element is a small binary
image, i.e. a small matrix of pixels, each with a
value of zero or one
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
Fitting & Hitting
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 B
1 1 1 1 0 C
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 A
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
Fundamental Operations
 Fundamentally morphological image
processing is very like spatial filtering.
 The structuring element is moved
across every pixel in the original
image to give a pixel in a new
processed image.
 The value of this new pixel depends on
the operation performed.
 There are two basic morphological
operations: erosion and dilation
Dilation
Dilation: Algorithm
Dilation
Dilation of image f by structuring
element s is given by f s
The structuring element s is
positioned with its origin at (x, y)
and the new pixel value is
determined using the rule:
1 if s hits f
g ( x, y ) 
0 otherwise
Dilation Example
Original Image Processed Image

Structuring Element
Dilation Example
Original Image Processed Image With Dilated Pixels

Structuring Element
Dilation Example 1

Original image Dilation by 3*3 Dilation by 5*5


square structuring square structuring
element element
Dilation Example 2
Original image After dilation
es taken from Gonzalez & Woods, Digital Image Processing (2002)

Structuring element
What Is Dilation For?
Dilation can repair breaks

Dilation can repair intrusions

Watch out: Dilation enlarges


objects
Erosion
Erosion: Algorithm
Erosion
Erosion of image f by structuring
element s is given by f  s
The structuring element s is
positioned with its origin at (x, y)
and the new pixel value is
determined using the rule:

 1 if s fits f
g ( x, y ) 
0 otherwise
Erosion Example
Original Image Processed Image With Eroded Pixels

Structuring Element
Erosion Example
Original Image Processed Image

Structuring Element
Erosion Example 1

Original image Erosion by 3*3 Erosion by 5*5


square structuring square structuring
element element

Watch out: In these examples a 1 refers to a black pixel!


Erosion Example 2
es taken from Gonzalez & Woods, Digital Image Processing (2002)

After erosion
Original
with a disc of
image
radius 10

After erosion After erosion


with a disc of with a disc of
radius 5 radius 20
What Is Erosion For?
Erosion can split apart joined objects

Erosion can strip away extrusions

Watch out: Erosion shrinks objects


Compound Operations
More interesting morphological
operations can be performed by
performing combinations of erosions
and dilations
The most widely used of these
compound operations are:
◦ Opening
◦ Closing
Opening
The opening of image f by
es taken from Gonzalez & Woods, Digital Image Processing (2002)

structuring element s, denoted f ○ s


is simply an erosion followed by a
dilation 
f ○ s = (f s) s

Original shape After erosion After dilation


(opening)

Note a disc shaped structuring element is used


es taken from Gonzalez & Woods, Digital Image Processing (2002)

After
Image
Image
Original

Opening
Opening Example
Opening Example
Original Image Processed Image

Structuring Element
Opening Example
Original Image Processed Image

Structuring Element
Opening
Similar to Erosion
◦ Spot and noise removal
◦ Less destructive
Erosion next dilation
the same structuring element for both
operations.
Input:
◦ Binary Image
◦ Structuring Element, containing only 1s!

Feb 11, 2025 40


Opening
Take the structuring element (SE) and
slide it around inside each foreground
region.
◦ All pixels which can be covered by the SE
with the SE being entirely within the
foreground region will be preserved.
◦ All foreground pixels which can not be
reached by the structuring element without
lapping over the edge of the foreground
object will be eroded away!
Opening is idempotent: Repeated
application has no further effects!

Feb 11, 2025 41


Closing
The closing of image f by
es taken from Gonzalez & Woods, Digital Image Processing (2002)

structuring element s, denoted f • s


is simply a dilation followed by an
erosion 
f • s = (f s)s

Original shape
After erosion
After dilation (closing)

Note a disc shaped structuring element is used


es taken from Gonzalez & Woods, Digital Image Processing (2002)

After
Image
Image
Original

Closing
Closing Example
Closing Example
Original Image Processed Image

Structuring Element
Closing Example
Original Image Processed Image

Structuring Element
Closing
Similar to Dilation
◦ Removal of holes
◦ Tends to enlarge regions, shrink
background
Closing is defined as a Dilatation,
followed by an Erosion using the same
structuring element for both
operations.
Dilation next erosion!
Input:
◦ Binary Image
◦ Structuring Element, containing only 1s!
Feb 11, 2025 46
Closing
Take the structuring element (SE) and
slide it around outside each
foreground region.
◦ All background pixels which can be
covered by the SE with the SE being
entirely within the background region will
be preserved.
◦ All background pixels which can not be
reached by the structuring element without
lapping over the edge of the foreground
object will be turned into a foreground.

Feb 11, 2025 47


Hit and Miss Transform
 Used to look for particular patterns of
foreground and background pixels
 Very simple object recognition
 All other morphological operations can be
derived from it!!
 Input:

–Binary Image
–Structuring Element, containing 0s and
1s!!
 Example for a Hit-and-miss Structuring Element
 Contains 0s, 1s and don’t care’s.
 Usually a “1” at the origin!
Hit and Miss Transform
 If foreground and background pixels in the
structuring element exactly match foreground
and background pixels in the image, then the
pixel underneath the origin of the structuring
element is set to the foreground color.
 The Hit-or-Miss transformation is useful to find
patterns in binary images.
 In particular, it finds those pixels whose
neighbourhood matches the shape of a first
structuring element B1 while not matching the
shape of a second structuring element B2 at the
same time.
 Mathematically, the operation applied to an
image A can be expressed as follows:
Hit and Miss Transform

You might also like