provides mathematical tools for shape analysis in both binary and grayscale images chapter 13 –...

56
Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing – noise removal, shape simplification (ii) Enhancement of object structure – skeletonizing, thinning, thickening, convex hull (iii) Object segmentation (iv) Quantitative description of objects – area, perimeter, Euler-Poincare characteristic 13.1 Basic Morphological Concepts 13-1

Upload: gwenda-tate

Post on 15-Jan-2016

217 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

Provides mathematical tools for shape analysis in both binary and grayscale images

Chapter 13 – Mathematical Morphology

Usages: (i) Image pre-processing – noise removal, shape simplification(ii) Enhancement of object structure – skeletonizing, thinning, thickening, convex hull(iii) Object segmentation(iv) Quantitative description of objects – area, perimeter, Euler-Poincare characteristic

13.1 Basic Morphological Concepts

13-1

Page 2: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

Morphological approach consists of 2 main steps:

(i) geometrical transformation , (ii) measurement

13.2 Morphological Principles

4 principles:

(1) Compatibility with translation -- If depends on

( ) ( ( ))h hX X the position of origin O, ;

( ) ( ( ))O h h hX X

otherwise,

(2) Compatibility with change of scale – If depends

on parameter , ;

1

( ) ( )X X

( ) ( )X X

otherwise,

13-2

Page 3: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

(4) Upper semi-continuity – Morphological transformation does not exhibit any abrupt changes

(3) Local knowledge – only a part of a structure can

be examined,( ( )) ( )X Z Z X Z

13.3 Binary Dilation and Erosion ◎ Basic Morphological Operations

○ Duality

( )X*( ) ( ( ))c cX X *( ) :X

○ Translation2{ : , }

or { | }

X X

X

h p p = x h x

h x x

:X h

2 : 2D space13-3

Page 4: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

Example: h = (2,2)

{ | }X X x x

○ Transposition -- Reflects a set of pixels w.r.t.

the originX

13-4

Page 5: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

13.3.1 Dilation: an image shape, : a structuring elementX B

2{ : , and }

or { | , }

ˆ ˆ { | ( ) } { | (( ) ) }

X B B

X B

B X B X X

x x

p p x b x X b

x b x b

x x

13-5

Dilation of X by B:

Page 6: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

can be obtained by replacing every x in X with a B

Properties:

,X B B X ,B

X B X

bb

( )h hX B X B

If then X Y X B Y B

。 It may be that

{(7,3),(6,2),(6,4),

(8,2),(8,4)}

B

X B

X X B

13-6

Page 7: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

13.3.2 Erosion2{ : , }

or { | }B

X B B

B X X

b bb

p p x b X b

b Steps: (i) Move B over X, (ii) Find all the places where B fits (iii) Mark the origin of B when fitting

13-7

Page 8: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

。 Erosion thins an shape

。 The origin of B may not be in B and X B X

。 Contours can be obtained by subtraction of an eroded shape from its original

13-8

Page 9: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

○ Dilation and erosion are inverses of each other, i.e.,

。 Duality

i. The complement of an erosion equals the

dilation of the complement

where is the reflection of BB

( )C CX B X B

ii. Exchange the erosion and dilation of the above

equation ( )C CX B X B

○ Neither erosion nor dilation is an invertible transformation

13-9

Page 10: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

。 Proof of

From the definition of erosion,

Its complement:

If , then

{ | }X B B X ww

{ | }CX B B X ww

B XwCB X w

{ | } { | }

{ | }

C C C

C C

X B B X B X

B X X B

w w

w

w w

w

( { | ( ) })X B B X ww

13-10

( )C CX B X B

Page 11: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

◎ Boundary Detection

Let B: Symmetric about its origin The boundary of X (i) Internal boundary: -- Pixels in A that are at its edge (ii) External boundary: -- Pixels outside X that are next to it (iii) Gradient boundary: -- a combination of internal and external boundary pixels

( )X X B

( )X B X

( ) ( )X B X B

13-11

Page 12: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

Internal boundary

external boundary

gradient boundary

13-12

Page 13: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

Internal boundary

external boundary gradient boundary13-13

Page 14: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

Properties: ( ) , ( ) ,h h h hX B X B X B X B

If then X Y X B Y B If then D B X B X D ( )C CX Y X Y

( ) ( ) ( )X Y B X B Y B ( ) ( ) ( )B X Y B X B Y

( ) ( ) ( ) ( )X Y B B X Y X B Y B ( ) ( ) ( ) ( )B X Y X Y B X B Y B

( ) ( ) ( )X Y B X B Y B ( ) ( ) ( )B X Y X B Y B

( ) ( )X B D X B D ( ) ( )X B D X B D

13-14

Page 15: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

13.3.3 Hit-or-Miss Transformation-- Find shapes

: the shape to be found

: fits around

1 2

1 2

1 2 1 2

{ : , }

or ( ) ( )

( ) \ ( ), ( , )

c

c

X B B X B X

X B X B

X B X B B B B

x

1B

1B2B

。 Example – find the square in an image

13-15

Page 16: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

1(i) X B

2(ii) cX B

1 2(iii) ( ) ( )cX B X B

13-16

Page 17: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

○ Opening of X by B

( ) { | }X B X B B B B X w w

13.3.4 Opening and Closing

13-17

Page 18: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

。 Properties:

(i)

(ii) Idempotence:

(iii)

X B X( )X B B X B

If , then ( ) ( )X Y X B Y B

(iv) Opening tends to (a) smooth image, (b) break narrow joins (c) remove thin protrusions

13-18

Page 19: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

○ Closing of X by B: ( )X B X B B

。 Properties:

(i)

(ii) Idempotence:

(iii)

( )X X B

( )X B B X B

If , then ( ) ( )X Y X B Y B (iv) Closing tends to (a) smooth image, (b) fuse narrow breaks (c) thin gulfs, (d) remove small holes

13-19

Page 20: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

13-20

( ) ,C CX B X B

( )C CX B X B

○ Properties:• Opening and closing are invariant to translation• Opening and closing are dual transformations

Page 21: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

13.4 Gray-Scale Dilation and Erosion

[ ]( ) max{ ,( , ) }T A y y A x x

nA 。 The top-surface of set[ ]T A○ Dilation

13-21

Page 22: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

13-22

。 The umbra of the top-surface of set A

[ ] {( , ) , ( )}U f y F y f x x

Let [ ].f T A

The umbra of function

[ ]T A

[ [ ]] {( , ) , [ ]( )}U T A y F y T A x x

1: , nf F F

The umbra of is[ ]T A

Example:

Page 23: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

13-23

。 The dilation of f by k:

{ [ ] [ ]},f k T U f U k 1, ,nF K : , :f F k K

where

max{ ( ) ( ), , }f k f x z k z z K x z F or

Page 24: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

。 Another illustration

For each p of X (i) Find its neighborhood according to the domain of B (ii) Compute , (iii) p = max{ }

Recall binary dilation

BDpN

pN BpN B

13-24

Page 25: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

Example:

Final result:

13-25

Page 26: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

( , )( )( , ) max { ( , ) ( , )}

Bs t DX B x y X x s y t B s t

。 Gray-scale Dilation:

For each pixel p of X,

(i) Lie the origin of B over p (ii) Find corresponding to B (iii) p = max{ }

pNpN B

Dilation increases light areas in an image

13-26

Page 27: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

○ Erosion

{ [ ] [ ]},f k T U f U k

min{ ( ) ( ), , }z K

f k f x z k z z K x z F

or

13-27

Page 28: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

(i) Move B over X,

(ii) Find all the places where B fits

(iii) Mark the origin of B when fitting

{ | }X B X B X xx

。 Another illustration

Recall binary erosion

13-28

Page 29: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

For each p of X

(i) Find its neighborhood according to the domain of B (ii) Compute , (iii) p = min{ }pN B

BD

pN B

pN

13-29

Page 30: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

( , )

1 , 1

( )(1,1) min { (1 ,1 ) ( , )}

min { (1 ,1 ) ( , )}Bs t D

s t

X B X s t B s t

X s t B s t

The value of X(1+s, 1+t) – B(s, t)

Minimum = 5

○ Example:

13-30

Page 31: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

Final result:

13-31

Page 32: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

( , )( )( , ) min { ( , ) ( , )}

Bs t DA B x y A x s y t B s t

。 Grayscale erosion:

For each pixel p of A,

(i) Lie the origin of B over p (ii) Find corresponding to B (iii) p = min{ }

pNpN B

Erosion decreases light areas in an image

13-32

Page 33: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

( ) ( )A B A B

3 × 3 square 5 × 5 square

◎ Edge Detection

◎ Remove impulse noise

(1) removes black pixels but enlarges holes

(2) fills holes but enlarges objects

(3) reduces size

Square Cross

A B(( ) )A B B B

((( ) ) ) (( ) )A B B B B A B B 13-33

Page 34: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

13.4.2 Umbra Homeomorphism Theorem, Properties of Erosion and Dilation, Opening and Closing

Umbra Homeomorphism Theorem:

[ ] [ ] [ ]U f k U f U k

[ ] [ ] [ ]U f k U f U k

Grey-scale opening: ( )f k f k k

Grey-scale closing: ( )f k f k k

Duality: ( )( ) (( ) )( )f k f k x x

13-34

Page 35: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

max{ } min{ }X Y X Y Let X, Y: matrices,

1 2 3 7 6 1

4 5 6 , 8 5 2

7 8 9 9 4 3

X Y

6 4 2

max{ } max{ 4 0 4 } 6

2 4 6

X Y

6 4 2

min{ } min{ 4 0 4 } 6

2 4 6

X Y

+, -: componentwise addition and subtraction

e.g.,

13-35

Page 36: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

max{ } , min{ } X Y A B X Y A B

13.4.3 Top Hat Transformation

-- For segmenting objects in images

\ ( )X X K

13-36

\ : subtractionwhere

max{ } min{ }X Y X Y

( ), ( )A B A B A B A B or ( ) , ( )A B A B A B A B

Page 37: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

13.5 Skeletons and Object Marking

Homotopic transformation: a transformation doesn’t change the continuity relation between regions and holes.

13-37

13.5.1 Homotopic transformations

A transformation is homotopic if it doesn’t change the homotopic tree.

Page 38: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

13-38

13.5.2 Skeleton, Maximal Ball

Meaning of skeleton (or medial axis):

Points where two ormore firefronts meet

Points lie on the trajectory of centers of maximal balls

Skeleton by maximal balls:

( ) { : 0, ( , ) : a maximal ball of }S X p X r B p r X

Page 39: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

Until ( ) , Skeleton = (differences)X kB B

Erosions Openings differences

( )

( ) ( ) (( ) )

2 ( 2 ) ( 2 ) (( 2 ) )

3 ( 3 )

X X B X X B

X B X B B X B X B B

X B X B B X B X B B

X B X B B

( 3 ) (( 3 ) )

( ) ( ) (( ) )

X B X B B

X kB X kB B X kB X kB B

0

( ) ( ) \ ( )n

S X X nB X nB B

: the ball of radius nnB B B B

where

○ Lantuejoul’s method

13-39

Page 40: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

Structuring element

Final result

13-40

Page 41: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

Examples:

13.5.3 Thinning and ThickeningThinning: \ ( ),X B X X B Thickening: ( )X B X X B

where 1 2( , )B B B

Duality: ( )c cX B X B 13-41

Page 42: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

Sequential thinning with 1 2( , ),L L L

1

0 0 0

1 ,

1 1 1

L

2

0 0

1 1 0

1

L

where

Sequential thinning with 1 2( , ),E E E

1

1

0 1 0 ,

0 0 0

E

2

0

0 1 0

0 0 0

E

where

13-42

Page 43: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

13-43

Page 44: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

13-44

13.5.4 Quench Function, Ultimate Erosion• Quench function reconstructs X as a union of its

maximal balls B.( )

( ( ) )Xp S X

X p q p B

where ( ) :S X skeleton of X

( ), ( ) :Xq p p S X ball of radius

• Global maximum, global minimum, local maximum, regional maximum

Page 45: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

13-45

• Ultimate erosion Ult(X ): the set of regional maxima of the quench function

Page 46: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

13-46

13.5.5 Ultimate Erosion and Distance Functions

Ult( ) ( ) \ ( ( 1) )X nBn N

X X nB X n B

where ( ) :A B the reconstruction of A from B

Ultimate erosion:

dist ( ) min{ , not in ( )}X p n N p X nB Distance function:

Influence zone:2( ) { , , ( , ) ( , )}i i jZ X p Z i j d p X d p X

Page 47: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

13-47

Skeleton by influence zone SKIZ: the set of

boundaries of influence zones { ( )}iZ X

13.5.6 Geodesic TransformationsAdvantages:

They operate only on some part of an image

Their structuring element can vary at each pixel

( , ) :Xd x yLet geodesic distance constrained in X

Page 48: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

13-48

The geodesic ball of center p X and radius n

( , ) { , ( , ) }X XB p n p X d p p n

The geodesic dilation of size n of Y inside X( ) ( ) ( , ) { , , ( , ) }nX X X

p Y

Y B p n p X p Y d p p n

The geodesic erosion of size n of Y inside X

( ) ( ) { , ( , ) }

{ , \ , ( , ) }

nX X

X

Y p Y B p n Y

p Y p X Y d p p n

Page 49: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

13-49

13.5.7 Morphological Reconstruction

Reconstruction of the connected components of X

that were marked by Y.( )( ) lim ( )n

X Xn

Y Y

For binary images,

Page 50: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

13-50

For grey scale images, considering increasing

transformations , i.e.,2, , ( ) ( )X Y Z Y X Y X

A grey-level image is viewed as a stack of binary

images obtained by successive thresholding.

( ) { , ( ) }, 0, ,k IT I p D I P k k N Thresholded grey scale image I:

Page 51: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

13-51

Threshold decomposition principle: , ( )( ) max{ [0, , ], ( ( ))}I kp D I p k N p T I

The reconstruction of I from J

, ( )( ) max{ [0, ], ( ( ))}kI T Kp D J p k N p T J

where D : the domain of I and J

Thresholded images obey the inclusion relation

1[1, ], ( ) ( )k kk N T I T I

Page 52: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

13-52

13.6 Granulometry

Page 53: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

13-53

13.7 Morphological Segmentation and Watersheds

13.7.1 Particles Segmentation, Marking, and Watersheds

13.7.2 Binary Morphological Segmentation

Page 54: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

13-54

Page 55: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

13-55

Page 56: Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing

13-56

13.7.3 Grey-Scale Segmentation, Watersheds