chapter 9 morphological image processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/eem...

90
EEM 463 Introduction to Image Processing Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof. Cihan Topal Anadolu University, Dept. EEE Slides Credit: Frank (Qingzhong) Liu

Upload: others

Post on 17-Aug-2020

21 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

EEM 463 Introduction to Image Processing

Chapter 9Morphological Image

Processing

Fall 2017

Assist. Prof. Cihan Topal

Anadolu University, Dept. EEE

Slides Credit: Frank (Qingzhong) Liu

Page 2: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 2

Introduction

► Morphology: a branch of biology that deals with theFORM and STRUCTURE of animals and plants

► Morphological image processing is used to extract imagecomponents for representation and description of regionshape, such as boundaries, skeletons, and the convexhull, connectivity analysis, blob analysis, ...

► Develop methods (region filling, thinning, thickening, andpruning) that are frequently used in conjunction withthese algorithms as pre-or post-processing steps

Page 3: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 3

Preliminaries (1)

► Reflection

► Translation

The reflection of a set , denoted , is defined as

{ | , for }

B B

B w w b b B

1 2The translation of a set by point ( , ), denoted ( ) ,

is defined as

( ) { | , for }

Z

Z

B z z z B

B c c b z b B

𝐵

𝐵

Page 4: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 4

Example: Reflection and Translation

Page 5: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 5

Preliminaries (2)

► Structure elements (SE)

Small sets or sub-images used to probe an image under study for properties of interest

Page 6: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 6

Examples: Structuring Elements (1)

origin

Page 7: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 7

Examples: Structuring Elements (2)Accommodate the entire structuring elements when its origin is on the border of the original set A

Origin of B visits every element of A

At each location of the origin of B, if B is completely contained in A, then the location is a member of the new set, otherwise it is not a member of the new set.

Page 8: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 8

Erosion

2With and as sets in , the erosion of by , denoted ,

defined

| ( )Z

A B Z A B A B

A B z B A

The set of all points such that , translated by , is contained by .z B z A

| ( ) c

ZA B z B A

Page 9: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 9

Example of

Erosion (1)

Page 10: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 10

Example of

Erosion (2)

Page 11: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 11

Dilation

2With and as sets in , the dilation of by ,

denoted , is defined as

A B= |z

A B Z A B

A B

z B A

• Does the structuring element hit the set?

𝐵

|z

A B z B A A 𝐵

The set of all displacements , the translated and

overlap by at least one element.

z B A𝐵

Page 12: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 12

Examples of Dilation (1)

Page 13: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 13

Examples of Dilation (2)

Page 14: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 14

Duality

► Erosion and dilation are duals of each other with respect to set complementation and reflection

c c

c c

A B A B

and

A B A B

𝐵

𝐵

The duality property is useful particularly when the structuring element is symmetric with respect to its origin (as often is the case)

𝐵 = 𝐵

Page 15: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

|

|

|

cc

Z

cc

Z

c

Z

c

A B z B A

z B A

z B A

A B

𝐵

12/25/2017 15

Duality

► Erosion and dilation are duals of each other with respect to set complementation and reflection

Page 16: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

|

|

cc

Z

c

Z

c

A B z B A

z B A

A B

𝐵

𝐵

12/25/2017 16

Duality

► Erosion and dilation are duals of each other with respect to set complementation and reflection

𝐵

Page 17: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 17

Opening and Closing

► Opening generally smoothes the contour of an object,

breaks narrow isthmuses, and eliminates thin

protrusions.

► Closing tends to smooth sections of contours but it

generates fuses narrow breaks and long thin gulfs,

eliminates small holes, and fills gaps in the contour.

Page 18: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 18

Opening and Closing

The opening of set by structuring element ,

denoted , is defined as

A B

A B

A B A B B

The closing of set by structuring element ,

denoted , is defined as

A B

A B

A B A B B

Page 19: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 19

Opening

The opening of set by structuring element ,

denoted , is defined as

|Z Z

A B

A B

A B B B A

Page 20: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 20

Example: Opening

Page 21: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 21

Example: Closing

Page 22: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 22

Page 23: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 23

Duality of Opening and Closing

► Opening and closing are duals of each other with respect to set complementation and reflection

( )c cA B A B

( )c cA B A B

Page 24: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 24

The Properties of Opening and Closing

► Properties of Opening

► Properties of Closing

(a) is a subset (subimage) of

(b) if is a subset of , then is a subset of

(c) ( )

A B A

C D C B D B

A B B A B

(a) is subset (subimage) of

(b) If is a subset of , then is a subset of

(c) ( )

A A B

C D C B D B

A B B A B

Page 25: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 25

Page 26: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 26

The Hit-or-Miss Transformation

if denotes the set composed of

and its background,the match

(or set of matches) of in ,

denoted ,

* c

B

D

B A

A B

A B A D A W D

1 2

1

2

1 2

,

: object

: background

( )c

B B B

B

B

A B A B A B

Page 27: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 27

Some Basic Morphological Algorithms (1)

► Boundary Extraction

The boundary of a set A, can be obtained by first eroding A by B and then performing the set difference between A and its erosion.

( )A A A B

Page 28: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 28

Example 1

Page 29: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 29

Example 2

Page 30: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 30

Some Basic Morphological Algorithms (2)

► Hole Filling

A hole may be defined as a background regionsurrounded by a connected border of foregroundpixels.

Let A denote a set whose elements are 8-connectedboundaries, each boundary enclosing a backgroundregion (i.e., a hole). Given a point in each hole, theobjective is to fill all the holes with 1s.

Page 31: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 31

Some Basic Morphological Algorithms (2)

► Hole Filling

1. Forming an array X0 of 0s (the same size as the array containing A), except the locations in X0 corresponding to the given point in each hole, which we set to 1.

2. Xk = (Xk-1 + B) Ac k=1,2,3,…

Stop the iteration if Xk = Xk-1

Page 32: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 32

Example

Page 33: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 33

Page 34: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 34

Some Basic Morphological Algorithms (3)

► Extraction of Connected Components

Central to many automated image analysis applications.

Let A be a set containing one or more connectedcomponents, and form an array X0 (of the same size asthe array containing A) whose elements are 0s, exceptat each location known to correspond to a point in eachconnected component in A, which is set to 1.

Page 35: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 35

Some Basic Morphological Algorithms (3)

► Extraction of Connected Components

Central to many automated image analysis applications.

1

-1

( )

: structuring element

until

k k

k k

X X B A

B

X X

Page 36: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 36

Page 37: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 37

Page 38: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 38

Some Basic Morphological Algorithms (4)

► Convex Hull

A set A is said to be convex if the straight line segment joining any two points in A lies entirely within A.

The convex hull H or of an arbitrary set S is the smallest convex set containing S.

Page 39: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 39

Some Basic Morphological Algorithms (4)

► Convex Hull

1

Let , 1, 2, 3, 4, represent the four structuring elements.

The procedure consists of implementing the equation:

( * )

1, 2,3,4 and 1,

i

i i

k k

B i

X X B A

i k

0

1

4

1

2,3,...

with .

When the procedure converges, or , let ,

the convex hull of A is

( )

i

i i i i

k k k

i

i

X A

X X D X

C A D

Page 40: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 40

Page 41: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 41

Page 42: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 42

Some Basic Morphological Algorithms (5)

► Thinning

The thinning of a set A by a structuring element B, defined

( * )

( * )c

A B A A B

A A B

Page 43: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 43

Some Basic Morphological Algorithms (5)

► A more useful expression for thinning A symmetrically is based on a sequence of structuring elements:

1 2 3

-1

, , ,...,

where is a rotated version of

n

i i

B B B B B

B B

1 2

The thinning of by a sequence of structuring element { }

{ } ((...(( ) )...) )n

A B

A B A B B B

Page 44: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 44

Page 45: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 45

Some Basic Morphological Algorithms (6)

► Thickening:

The thickening is defined by the expression

*A B A A B

1 2

The thickening of by a sequence of structuring element { }

{ } ((...(( ) )...) )n

A B

A B A B B B

In practice, the usual procedure is to thin the background of the set

and then complement the result.

Page 46: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 46

Some Basic Morphological Algorithms (6)

Page 47: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 47

Some Basic Morphological Algorithms (7)

► Skeletons

A skeleton, ( ) of a set has the following properties

a. if is a point of ( ) and ( ) is the largest disk

centered at and contained in , one cannot find a

larger disk containing ( )

z

z

S A A

z S A D

z A

D and included in .

The disk ( ) is called a maximum disk.

b. The disk ( ) touches the boundary of at two or

more different places.

z

z

A

D

D A

Page 48: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 48

Some Basic Morphological Algorithms (7)

Page 49: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 49

Some Basic Morphological Algorithms (7)

0

The skeleton of A can be expressed in terms of

erosion and openings.

( ) ( )

with max{ | };

( ) ( ) ( )

where is a structuring element, and

K

kk

k

S A S A

K k A kB

S A A kB A kB B

B

( ) ((..(( ) ) ...) )

successive erosions of A.

A kB A B B B

k

Page 50: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 50

Page 51: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 51

Page 52: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 52

Some Basic Morphological Algorithms (7)

0

A can be reconstructed from the subsets by using

( ( ) )

where ( ) denotes successive dilations of A.

( ( ) ) ((...(( ( ) ) )... )

K

kk

k

k k

A S A kB

S A kB k

S A kB S A B B B

Page 53: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 53

Page 54: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 54

Some Basic Morphological Algorithms (8)

► Pruning

a. Thinning and skeletonizing tend to leave parasitic components

b. Pruning methods are essential complement to thinning and

skeletonizing procedures

Page 55: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 55

Pruning: Example

1 { }X A B

Page 56: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 56

Pruning: Example

8

2 11

* k

kX X B

Page 57: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 57

Pruning: Example

3 2

: 3 3 structuring element

X X H A

H

Page 58: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 58

Pruning: Example

4 1 3X X X

Page 59: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 59

Pruning: Example

Page 60: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 60

Summary (1)

Page 61: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 61

Summary (2)

Page 62: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 62

Page 63: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 63

Page 64: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

Gray-Scale Morphology

►Unlike binary images we deal with digital imagefunctions of the form f(x,y) as an input imageand b(x,y) as a structuring element.

► f(x,y) and b(x,y) are functions that assign graylevel value to each distinct pair of coordinates.

►Remember that, the domain of gray values canbe 0-255, whereas 0 is black, 255 is white.

12/25/2017 64

Page 65: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 65

Gray-Scale Morphology

( , ) : gray-scale image

( , ): structuring element

f x y

b x y

Page 66: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 66

Gray-Scale Morphology: Erosion and Dilation by Flat Structuring

( , )

( , )

( , ) min ( , )

( , ) max ( , )

s t b

s t b

f b x y f x s y t

f b x y f x s y t

► The condition that (x-s),(y-t) need to be in the domain off and x,y in the domain of b,

It is completely analogous to the condition in the binary definition oferosion, where the structuring element has to be completely combinedby the set being eroded.

It is analogous to the condition in the binary definition of dilation, wherethe two sets need to overlap by at least one element.

Page 67: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 67

Page 68: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

Effects of Grayscale Erosion

► General effect of performing an erosion in grayscaleimages:

If all elements of the structuring element are positive, the outputimage tends to be darker than the input image.

The effect of bright details in the input image that are smaller inarea than the structuring element is reduced, with the degree ofreduction being determined by the grayscale values surrounding bythe bright detail and by shape and amplitude values of thestructuring element itself.

► Similar to binary image grayscale erosion and dilation areduals with respect to function complementation andreflection.

12/25/2017 68

Page 69: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

Effects of Greyscale Dilation

►The general effects of performing dilation on a gray scale image is two fold:

If all the values of the structuring elements are positive than the output image tends to be brighter than the input.

Dark details either are reduced or eliminated, depending on how their values and shape relate to the structuring element used for dilation.

12/25/2017 69

Page 70: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 70

Gray-Scale Morphology: Erosion and Dilation by Nonflat Structuring

( , )

( , )

( , ) min ( , ) ( , )

( , ) max ( , ) ( , )

N Ns t b

N Ns t b

f b x y f x s y t b s t

f b x y f x s y t b s t

► The resulting image will not be bounded by the values of f, which can present problem in interpreting it.

► Also, it is difficult to select meaningful SEs and it increases computational burden.

► Gray-scale SEs are seldom used in practice because of this.

Page 71: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 71

Duality: Erosion and Dilation

( , ) ( , )

where ( , ) and ( , )

c c

c

c c

f b x y f b x y

f f x y b b x y

f b f b

( )c cf b f b

Page 72: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 72

Opening and Closing

f b f b b

f b f b b

c c

c c

f b f b f b

f b f b f b

► In the opening of a gray-scale image, we remove smalllight details, while relatively undisturbed overall gray levelsand larger bright features

► In the closing of a gray-scale image, we remove small darkdetails, while relatively undisturbed overall gray levels andlarger dark features

Page 73: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 73

Page 74: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 74

Properties of Gray-scale Opening

1 2 1 2

( )

( ) if , then

( )

where denotes is a subset of and also

( , ) ( , ).

a f b f

b f f f b f b

c f b b f b

e r e r

e x y r x y

Page 75: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 75

Properties of Gray-scale Closing

1 2 1 2

( )

( ) if , then

( )

a f f b

b f f f b f b

c f b b f b

Page 76: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 76

Page 77: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 77

Morphological Smoothing

► Opening suppresses bright details smaller than the specified SE, and closing suppresses dark details.

► Opening and closing are used often in combination as morphological filters for image smoothing and noise removal.

Page 78: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 78

Morphological Smoothing

Page 79: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

Dilation & Erosion & Smoothing

12/25/2017 79

Page 80: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 80

Morphological Gradient

► Dilation and erosion can be used in combination with image subtraction to obtain the morphological gradient of an image, denoted by g,

► The edges are enhanced and the contribution of the homogeneous areas are suppressed, thus producing a “derivative-like” (gradient) effect.

( ) ( )g f b f b

Page 81: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 81

Morphological Gradient

Page 82: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 82

Top-hat and Bottom-hat Transformations

► The top-hat transformation of a grayscale image f is defined as f minus its opening:

► The bottom-hat transformation of a grayscale image f is defined as its closing minus f:

( ) ( )hatT f f f b

( ) ( )hatB f f b f

Page 83: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 83

Top-hat and Bottom-hat Transformations

► One of the principal applications of these transformations is in removing objects from an image by using structuring element in the opening or closing operation

Page 84: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 84

Example of Using Top-hat Transformation in Segmentation

Page 85: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 85

Granulometry

► Granulometry deals with determining the size distribution of particles in an image

► Opening operations of a particular size should have the most effect on regions of the input image that contain particles of similar size

► For each opening, the sum (surface area) of the pixel values in the opening is computed

Page 86: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

Granulometry

► In practice, particles seldom are neatly separated, which makes particle counting by identifying individual particles a difficult task.

►Morphology can be used to estimate particle size distribution indirectly, without having to identify and measure every particle in the image.

12/25/2017 86

Page 87: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 87

Example

Page 88: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 88

Page 89: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 89

Textual Segmentation

► Segmentation: the process of subdividing an image into regions.

Page 90: Chapter 9 Morphological Image Processing - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 463/icerik/EEM463... · Chapter 9 Morphological Image Processing Fall 2017 Assist. Prof

12/25/2017 90

Textual Segmentation