0% found this document useful (0 votes)
71 views72 pages

A. Introduction To Morphological Operators

The document introduces morphological operators such as erosion, dilation, opening and closing. Erosion removes foreground pixels that overlap the structuring element placed on background pixels, shrinking foreground areas. Dilation adds pixels to the boundaries of foreground objects by placing the structuring element over foreground and background pixels. Opening performs erosion followed by dilation and is used to remove noise while preserving object shape.

Uploaded by

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

A. Introduction To Morphological Operators

The document introduces morphological operators such as erosion, dilation, opening and closing. Erosion removes foreground pixels that overlap the structuring element placed on background pixels, shrinking foreground areas. Dilation adds pixels to the boundaries of foreground objects by placing the structuring element over foreground and background pixels. Opening performs erosion followed by dilation and is used to remove noise while preserving object shape.

Uploaded by

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

Introduction to

Morphological
Operators
Feb 26, 2017 1
About this lecture
In this lecture we introduce INFORMALLY
the most important operations based on
morphology, just to give you the intuitive
feeling.
In next lectures we will introduce more
formalism and more examples.

02/26/17 2
EROSION
02/26/17 3
What We Do Today. 2nd Part
Introduction to Morphological Operators
Used generally on binary images, e.g., background
subtraction results!
Used on gray value images, if viewed as a stack to
binary images.
Good for, e.g.,
Noise removal in background
Removal of holes in foreground / background
Check: www.cee.hw.ac.uk/hipr
A first Example: Erosion
Erosion is an important morphological
operation

Applied Structuring Element:

Feb 26, 2017 5


Example for Erosion
Input image 1 0 0 0 1 1 1 0 1 1

Structuring Element 1 1 1

Output Image 0

Feb 26, 2017 6


Example for Erosion
Input image 1 0 0 0 1 1 1 0 1 1

Structuring Element 1 1 1

Output Image 0 0

Feb 26, 2017 7


Example for Erosion
Input image 1 0 0 0 1 1 1 0 1 1

Structuring Element 1 1 1

Output Image 0 0 0

Feb 26, 2017 8


Example for Erosion
Input image 1 0 0 0 1 1 1 0 1 1

Structuring Element 1 1 1

Output Image 0 0 0 0

Feb 26, 2017 9


Example for Erosion
Input image 1 0 0 0 1 1 1 0 1 1

Structuring Element 1 1 1

Output Image 0 0 0 0 1

Feb 26, 2017 10


Example for Erosion
Input image 1 0 0 0 1 1 1 0 1 1

Structuring Element 1 1 1

Output Image 0 0 0 0 1 0

Feb 26, 2017 11


Example for Erosion
Input image 1 0 0 0 1 1 1 0 1 1

Structuring Element 1 1 1

Output Image 0 0 0 0 1 0 0

Feb 26, 2017 12


Example for Erosion
Input image 1 0 0 0 1 1 1 0 1 1

Structuring Element 1 1 1

Output Image 0 0 0 0 1 0 0 0

Feb 26, 2017 13


Introduction
Structuring Element
Erosion
Dilation
Opening
Closing
Outlook: Hit-and-miss Operation, Thinning,
Thickening

Feb 26, 2017 14


Structuring Element (Kernel)
Structuring Elements can have varying sizes
Usually, element values are 0,1 and none(!)
Structural Elements have an origin
For thinning, other values are possible
Empty spots in the Structuring Elements are dont
cares!

Box

Disc

Examples of stucturing elements


Feb 26, 2017 15
Dilation & Erosion
Basic operations
Are dual to each other:
Erosion shrinks foreground, enlarges
Background

Dilation enlarges foreground, shrinks


background

Feb 26, 2017 16


Erosion
Erosion is the set of all points in the image, where
the structuring element fits into.
Consider each foreground pixel in the input image
If the structuring element fits in, write a 1 at the
origin of the structuring element!
Simple application of pattern matching
Input:
Binary Image (Gray value)
Structuring Element, containing only 1s!

Feb 26, 2017 17


Another example of erosion

White = 0, black = 1, dual property, image as a result of erosion gets darker

Feb 26, 2017 18


Erosion on Gray Value Images
View gray value images as a stack of binary
images!

Feb 26, 2017 19


Erosion on Gray Value Images

Images get darker!

Feb 26, 2017 20


Counting Coins
Counting coins is difficult because they
touch each other!
Solution: Binarization and Erosion
separates them!

Feb 26, 2017 21


DILATION

02/26/17 22
Example: Dilation
Dilation is an important morphological
operation

Applied Structuring Element:

Feb 26, 2017 23


Dilation
Dilation is the set of all points in the image, where
the structuring element touches the foreground.
Consider each pixel in the input image
If the structuring element touches the foreground
image, write a 1 at the origin of the structuring
element!
Input:
Binary Image
Structuring Element, containing only 1s!!
Feb 26, 2017 24
Example for Dilation
Input image 1 0 0 0 1 1 1 0 1 1

Structuring Element 1 1 1

Output Image 1

Feb 26, 2017 25


Example for Dilation
Input image 1 0 0 0 1 1 1 0 1 1

Structuring Element 1 1 1

Output Image 1 0

Feb 26, 2017 26


Example for Dilation
Input image 1 0 0 0 1 1 1 0 1 1

Structuring Element 1 1 1

Output Image 1 0 1

Feb 26, 2017 27


Example for Dilation
Input image 1 0 0 0 1 1 1 0 1 1

Structuring Element 1 1 1

Output Image 1 0 1 1

Feb 26, 2017 28


Example for Dilation
Input image 1 0 0 0 1 1 1 0 1 1

Structuring Element 1 1 1

Output Image 1 0 1 1 1

Feb 26, 2017 29


Example for Dilation
Input image 1 0 0 0 1 1 1 0 1 1

Structuring Element 1 1 1

Output Image 1 0 1 1 1 1

Feb 26, 2017 30


Example for Dilation
Input image 1 0 0 0 1 1 1 0 1 1

Structuring Element 1 1 1

Output Image 1 0 1 1 1 1 1

Feb 26, 2017 31


Example for Dilation
Input image 1 0 0 0 1 1 1 0 1 1

Structuring Element 1 1 1

Output Image 1 0 1 1 1 1 1 1

Feb 26, 2017 32


Another Dilation Example

Image get lighter, more uniform intensity


Feb 26, 2017 33
Dilation on Gray Value Images
View gray value images as a stack of binary
images!

Feb 26, 2017 34


Dilation on Gray Value Images

More uniform intensity

Feb 26, 2017 35


Edge Detection
Edge Detection
1. Dilate input image
2. Subtract input image from dilated image
3. Edges remain!

Feb 26, 2017 36


Opening & Closing
Important operations
Derived from the fundamental operations
Dilatation
Erosion
Usually applied to binary images, but gray
value images are also possible
Opening and closing are dual operations
Feb 26, 2017 37
OPENING

02/26/17 38
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 26, 2017 39


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 26, 2017 40


Opening
Structuring element: 3x3 square

Feb 26, 2017 41


Opening Example
Opening with a 11 pixel diameter disc

Feb 26, 2017 42


Opening Example
3x9 and 9x3 Structuring Element

3*9

9*3

Feb 26, 2017 43


Opening on Gray Value Images
5x5 square structuring element

Feb 26, 2017 44


Use Opening for Separating
Blobs
Use large structuring element that fits into
the big blobs
Structuring Element: 11 pixel disc

Feb 26, 2017 45


CLOSING

02/26/17 46
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 26, 2017 47
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.
Opening is idempotent: Repeated application has
no further effects!

Feb 26, 2017 48


Closing
Structuring element: 3x3 square

Feb 26, 2017 49


Closing Example
Closing operation with a 22 pixel disc
Closes small holes in the foreground

Feb 26, 2017 50


Closing Example 1
1. Threshold
2. Closing with disc of size 20

Feb 26, 2017


Thresholded closed 51
Closing Example 2
Good for further processing: E.g. Skeleton
operation looks better for closed image!

skeleton of skeleton of Thresholded and


Thresholded next closed 52
Closing Gray Value Images
5x5 square structuring element

Feb 26, 2017 53


Opening & Closing
Opening is the dual of closing
i.e. opening the foreground pixels with a
particular structuring element
is equivalent to closing the background
pixels with the same element.

Feb 26, 2017 54


HIT and
MISS
02/26/17 55
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!!
Feb 26, 2017 56
Hit-and-miss Transform
Example for a Hit-and-miss Structuring Element
Contains 0s, 1s and dont cares.
Usually a 1 at the origin!

Feb 26, 2017 57


Hit-and-miss Transform
Similar to Pattern Matching:
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.

Feb 26, 2017 58


Corner Detection with Hit-and-
miss Transform
Structuring Elements representing four
corners

Feb 26, 2017 59


Corner Detection with Hit-and-
miss Transform
Apply each Structuring Element
Use OR operation to combine the four
results

Feb 26, 2017 60


Basic
THINNING
02/26/17 61
Thinning
1. Used to remove selected foreground
pixels from binary images

2. After edge detection, lines are often


thicker than one pixel.

3. Thinning can be used to thin those line to


one pixel width.
Feb 26, 2017 62
Definition of Thinning
Let K be a kernel and I be an image

thin I , K I HitAndMiss I , K
with 0-1=0!!
If foreground and background fit the structuring element
exactly, then the pixel at the origin of the SE is set to 0

Note that the value of the SE at the origin is 1 or dont


care!

Feb 26, 2017 63


Example Thinning
We use two Hit-and-
miss Transforms

Feb 26, 2017 64


Basic
THICKENING
02/26/17 65
Thickening
Used to grow selected regions of
foreground pixels
E.g. applications like approximation of
convex hull

Feb 26, 2017 66


Definition Thickening
Let K be a kernel and I be an image

thicken I , K I HitAndMiss I , K
with 1+1=1
If foreground and background match exactly the
SE, then set the pixel at its origin to 1!
Note that the value of the SE at the origin is 0 or
dont care!
Feb 26, 2017 67
Example Thickening

Feb 26, 2017 68


PROBLEMS

02/26/17 69
Problems
1. Consider the images on slide 17! Why are the images getting
darker under erosion? Explain!

2. Consider the images on slide 31! Why are the intensities


becoming more uniform? Explain!

3. Compare Dilatation and Erosion! How are they related?


Verify your answers with Matlab!

4. Apply Erosion and Dilatation for noise removal!

5. Consider slide 38: Remove the artefacts remaining with the


horizontal lines.
Feb 26, 2017 70
Problems
6. Derive dilatation and erosion from the
Hit-and-miss transformation

Feb 26, 2017 71


Sources Used

Volker Krger & Rune Andersen


University of Aalborg, Esbjerg

Feb 26, 2017 72

You might also like