46
Digital Image Processing Lecture # 09 Morphological Image Processing Autumn 2012

Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing

Lecture # 09

Morphological Image Processing

Autumn 2012

Page 2: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 2

Agenda

►Image Morphology

►Erosion

►Dilation

►Opening

►Closing

►Hit-Miss Transformation

►Misc. Morphological Operations

Page 3: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 3

Introduction

► Morphology: a branch of biology that deals with the form and structure of animals and plants

► Morphological image processing is used to extract image components for representation and description of region shape, such as boundaries, skeletons, and the convex hull

Page 4: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 4

Mathematic Morphology

mathematical framework used for:

►pre-processing

noise filtering, shape simplification, ...

►enhancing object structure

skeletonization, convex hull...

►quantitative description

area, perimeter, ...

Page 5: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 5

Basic Set Theory

Page 6: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 6

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 7: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 7

Example: Reflection and Translation

Page 8: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 8

Preliminaries (2)

► Structure elements (SE)

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

Page 9: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 9

Examples: Structuring Elements (1)

origin

Page 10: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 10

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 11: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 11

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 12: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 12

Example of

Erosion (1)

Page 13: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 13

Erosion Example

Structuring Element

Original Image Processed Image With Eroded Pixels

Page 14: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 14

Erosion Example

Structuring Element

Original Image Processed Image

Page 15: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 15

Erosion Example 2

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

Original image Erosion by 3*3

square structuring

element

Erosion by 5*5

square structuring

element

Page 16: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 16

Erosion Example 3

Original

image

After erosion

with a disc of

radius 10

After erosion

with a disc of

radius 20

After erosion

with a disc of

radius 5

Page 17: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 17

What Is Erosion For?

Erosion can split apart joined objects

Erosion can strip away extrusions

Watch out: Erosion shrinks objects

Page 18: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 18

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

The set of all displacements , the translated and

overlap by at least one element.

z B A

|z

A B z B A A

Page 19: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 19

Examples of Dilation (1)

Page 20: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 20

Dilation Example

Structuring Element

Original Image Processed Image

Page 21: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 21

Dilation Example

Structuring Element

Original Image Processed Image With Dilated Pixels

Page 22: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 22

Dilation Example 2

Original image Dilation by 3*3

square structuring

element

Dilation by 5*5

square structuring

element

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

Page 23: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 23

Examples of Dilation (3)

Page 24: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 24

What Is Dilation For?

Dilation can repair breaks

Dilation can repair intrusions

Watch out: Dilation enlarges objects

Page 25: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 25

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

Page 26: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 26

Duality

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

|

|

|

cc

Z

cc

Z

c

Z

c

A B z B A

z B A

z B A

A B

Page 27: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 27

Duality

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

|

|

cc

Z

c

Z

c

A B z B A

z B A

A B

Page 28: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 28

Page 29: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 29

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 30: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 30

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 31: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 31

Opening

The opening of set by structuring element ,

denoted , is defined as

|Z Z

A B

A B

A B B B A

Page 32: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 32

Opening Example

Original

Image

Image

After

Opening

Page 33: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 33

Closing Example

Original

Image

Image

After

Closing

Page 34: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 34

Opening and Closing

Page 35: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 37

Page 36: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 38

Duality of Opening and Closing

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

)ˆ()( BABA cc

Page 37: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 39

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 38: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 40

Page 39: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 41

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 40: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 42

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 41: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 43

Example 1

Page 42: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 44

Example 2

Page 43: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 45

Some Basic Morphological Algorithms (2)

► Hole Filling

A hole may be defined as a background region surrounded by a connected border of foreground pixels.

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

Page 44: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 46

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 45: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 47

Example

Page 46: Digital Image Processing - University of Engineering and ... · Digital Image Processing Lecture # 9 10 Examples: Structuring Elements (2) Accommodate the entire structuring elements

Digital Image Processing Lecture # 9 48