Sie sind auf Seite 1von 14

6/6/2020

Contents
Once segmentation is complete,
morphological operations can be used to
Morphological Image Processing remove imperfections in the segmented
image and provide information on the form
and structure of the image
In this lecture we will consider
– What is morphology?
– Simple morphological operations
– Compound operations
– Morphological algorithms

1, 0, Black, White? INTRODUCTION


Throughout all of the following slides
whether 0 and 1 refer to white or black is a • The word Morphology denotes a branch of biology that deals with
the form and structure of animals and plants.
little interchangeable
• Here we use the same word in the context of Mathematical
All of the discussion that follows assumes Morphology, which means as a tool for extracting image
components that are useful in the representation and description
segmentation has already taken place and of region shape, such as boundaries, skeletons etc.

that images are made up of 0s for • The language of Mathematical Morphology is set theory.

background pixels and 1s for object pixels • Sets in Mathematical Morphology represents objects in an image.

After this it doesn’t matter if 0 is black, white, • Motive is to extract useful features from shape

yellow, green…….

1
6/6/2020

INTRODUCTION What Is Morphology?

• Morph means shape

• We do Morphology for shape analysis & shape Morphological operations are typically applied
study. to remove imperfections introduced during
• Shape analysis became easy in case of binary segmentation, and so typically operate on bi-
images. level images
• Pixel Locations describe the shape.

• Digital Morphology is a way to describe or


analyze the shape of a digital image

Quick Example Basic Concepts From Set theory


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

Let A and B be sets.


To indicate a is an element of A write a  A.
To indicate a is not an element of A write a  A.
A is a subset of B, written A  B, if for every a  A, a  B.
The union of A and B, A  B  x | x  A or x  B.
The intersecti on of A and B, A  B  x | x  A and x  B.
The complement of A, A c  x | x  A.
Image after segmentation Image after segmentation and
morphological processing

The difference of A and B, A  B  x | x  A and x  B.

2
6/6/2020

Basic SET Theory Set Operations on Images


AND, OR

• Union
• Intersection
• Difference
• Complement
• Reflection
•Translation

TRANSLATION REFLECTION

FIGURE 9.1

3
6/6/2020

Set Operations
LOGICAL OPERATIONS

Structuring Elements, Hits & Fits Structuring Elements


Structuring elements can be any size and
B Structuring Element make any shape
Fit: All on pixels in the However, for simplicity we will use
structuring element cover rectangular structuring elements with their
on pixels in the image origin at the middle pixel
A
Hit: Any on pixel in the 0 0 1 0 0
C structuring element covers 1 1 1 0 1 0 0 1 1 1 0
an on pixel in the image
1 1 1 1 1 1 1 1 1 1 1
All morphological processing operations are based 1 1 1 0 1 0 0 1 1 1 0
on these simple ideas 0 0 1 0 0

4
6/6/2020

Fitting & Hitting Fundamental Operations

0 0 0 0 0 0 0 0 0 0 0 0 • Fundamentally morphological image processing


1 1 1 is very like spatial filtering
0 0 0 1 1 0 0 0 0 0 0 0
1 1 1
0 0 1 B
1 1 1 1 0 0 C
0 0 0 • The structuring element is moved across every
1 1 1
0 1 1 1 1 1 1 1 0 0 0 0 Structuring
pixel in the original image to give a pixel in a
0 1 1 1 1 1 1 1 0 0 0 0 Element 1 new processed image
0 0 1 1 1 1 1 1 0 0 0 0 0 1 0 • The value of this new pixel depends on the
0 0 1 1 1 1 1 1 1 0 0 0 1 1 1 operation performed
0 0 1 1 1 1 1 A
1 1 1 1 0 0 1 0 • There are two basic morphological operations:
0 0 0 0 0 1 1 1 1 1 1 0 Structuring
Element 2
dilation and erosion
0 0 0 0 0 0 0 0 0 0 0 0

Dilation
Dilation
Dilation of image f by structuring element s is
Dilation expands the connected sets of 1s of a binary image.
given by f  s
It can be used for
The structuring element s is positioned with
its origin at (x, y) and the new pixel value is
1. growing regions
determined using the rule:
2. filling holes and gaps
1 if s hits f
g ( x, y)  
0 otherwise
19

5
6/6/2020

Structuring Elements (SE) Dilation

How It Works?
A structuring element is a shape mask used in
the basic morphological operations. • It is similar to convolution process, that is
They can be any shape and size that is
structuring element is reflected and shifted
digitally representable, and each has an origin. from left to right and from top to bottom, at
each shift; the process will look for any
overlapping similar pixels between the SE and
that of Binary Image.
• If there exists an overlapping then the pixels
box under the centre position of the structuring
hexagon disk
something
element will be turned to 1or black
box(length,width) disk(diameter)
21

DILATION Dilation Example


Original Image Processed Image With Dilated Pixels

Structuring Element

6
6/6/2020

Dilation Example 1 Dilation Example 2


Original image After dilation

Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Original image Dilation by 3*3 Dilation by 5*5
square structuring square structuring
element element

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

What Is Dilation For? Erosion


Dilation can repair breaks -Counter process of dilation
-Shrink the image
-Erosion of image f by structuring element s
is given by f  s
Dilation can repair intrusions -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)  
Watch out: Dilation enlarges objects 0 otherwise

7
6/6/2020

Erosion Erosion

How It Works?
• Similar to dilation process, the erosion process will
move the SE from left to right and from top to
bottom.
• At the center position, indicated by the center of the
SE, the process will look for any whether there is a • It can be also defined as as
complete overlap with the SE or not.
• If there is no complete overlapping then the center
pixel indicated by the center of the structuring
element will be set to 0 or white

Erosion Example Erosion Example 1


Original Image Processed Image

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


square structuring square structuring
element element

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

8
6/6/2020

Erosion Example 2 What Is Erosion For?


Erosion can split apart joined objects
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

After erosion
Original
with a disc of
image
radius 10
Erosion can split apart

Erosion can strip away extrusions


After erosion After erosion
with a disc of with a disc of
radius 5 radius 20

Watch out: Erosion shrinks objects

Compound Operations Opening


More interesting morphological operations The opening of image f by structuring
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

can be performed by performing element s, denoted f ○ s is simply an erosion


combinations of erosions and dilations followed by a dilation
The most widely used of these compound f ○ s = (f s) s
operations are:
– Opening
– Closing

Original shape After erosion After dilation


(opening)

Note a disc shaped structuring element is used

9
6/6/2020

Opening Example Opening Example


Original Image Processed Image
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

Original
Image

Image
After
Opening
Structuring Element

Closing Closing Example


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

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

element s, denoted f • s is simply a dilation


followed by an erosion Original
Image
f • s = (f  s)s

Image
Original shape
After
After dilation After erosion
(closing) Closing

Note a disc shaped structuring element is used

10
6/6/2020

Closing Example Morphological Processing Example


Original Image Processed Image

Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Structuring Element

Morphological Algorithms Boundary Extraction


Using the simple technique we have looked Extracting the boundary (or outline) of an
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

at so far we can begin to consider some object is often extremely useful


more interesting morphological algorithms The boundary can be given simply as
We will look at: β(A) = A – (AB)
– Boundary extraction
– Region filling
There are lots of others as well though:
– Extraction of connected components
– Thinning/thickening
– Skeletonisation

11
6/6/2020

Boundary Extraction Example Region Filling


A simple image and the result of performing Given a pixel inside a boundary, region
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

Images taken from Gonzalez & Woods, Digital Image Processing (2002)
boundary extraction using a square 3*3 filling attempts to fill that boundary with
structuring element object pixels (1s)

Given a point inside


here, can we fill the
whole circle?

Original Image Extracted Boundary

Region Filling (cont…) Region Filling Step By Step


The key equation for region filling is
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

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

X k  ( X k 1  B)  Ac k  1,2,3.....
Where X0 is simply the starting point inside
the boundary, B is a simple structuring
element and Ac is the complement of A
This equation is applied repeatedly until Xk
is equal to Xk-1
Finally the result is unioned with the original
boundary

12
6/6/2020

Region Filling Example Summary


The purpose of morphological processing is
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

primarily to remove imperfections added during


segmentation
The basic operations are erosion and dilation
Using the basic operations we can perform
opening and closing
Original Image One Region All Regions More advanced morphological operation can
Filled Filled then be implemented using combinations of all
of these

Morphological Image Processing

13
6/6/2020

Morphological Operations

Morphological Operations

Thank You

14

Das könnte Ihnen auch gefallen