mathematical morphology lecture 14 course book reading: gw 9.1-4 lucia ballerini digital image...

44
Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

Upload: dylan-powell

Post on 12-Jan-2016

213 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

Mathematical Morphology

Lecture 14

Course book reading: GW 9.1-4Course book reading: GW 9.1-4

Lucia Ballerini

Digital Image Processing

Page 2: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

Mathematical MorphologyMathematical Morphology

mathematical framework used for: • pre-processing

• noise filtering, shape simplification, ...• enhancing object structure

• skeletonization, convex hull...• segmentation

•watershed,…• quantitative description

• area, perimeter, ...

Page 3: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

Set theory Set theory

A is a set in Z2

a=(a1,a2) is an element in A: aA

a=(a1,a2) is not an element in A: aA

empty set:

set specified using { }, e.g., C={w|w=-d, for dD}

every element in A is also in B (subset): AB

Page 4: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

Set theory Set theory

union of A and B: C=AB={c|cA or cB}

intersection of A and B: C=AB={c|cA and cB}

disjoint/mutually exclusive: AB=

AB

AB

Page 5: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

Set theory Set theory

complement of A: AC={w|wA}

difference of A and B: A-B={w|wA,wB}=ABC

AC

A-B

Page 6: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

Set theory Set theory

reflection of A: Â={w|w=-a, for aA}

translation of A by a point z=(z1,z2): (A)z={c|c=a+c, for aA}

Â

(A)z

Page 7: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

Logical operationsLogical operations

►pixelwise combination of imagespixelwise combination of images►AND, OR, NOTAND, OR, NOT

pp qq p AND qp AND q

(p(pq, pq, pq)q)p OR qp OR q

(p+q, p(p+q, pq)q)NOT pNOT p

((pp,,p)p)

00 00 00 00 11

00 11 00 11 11

11 00 00 11 00

11 11 11 11 00

Page 8: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

A B

NOT A A AND B

A OR B A XOR B

Page 9: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

Structuring element (SE)Structuring element (SE)

►small set to probe the image under studysmall set to probe the image under study►for each SE, define origofor each SE, define origo

SE in point p: origo coincides with pSE in point p: origo coincides with p

►shape and size must be adapted to shape and size must be adapted to geometric properties for the objectsgeometric properties for the objects

Page 10: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

Basic ideaBasic idea

► in parallel for each pixel in binary image: in parallel for each pixel in binary image: check if SE is ”satisfied”check if SE is ”satisfied” output pixel is set to 0 or 1 depending on output pixel is set to 0 or 1 depending on

used operationused operation

pixels in output image if check is:

SE fits

Page 11: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

How to describe SEHow to describe SEmany different ways!

information needed:• position of origo for SE• positions of elements belonging to SE

line segment

pair of points(separated by one pixel)

line segment(origo is not in SE)

origo

line segment(origo is not in SE)

Page 12: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

Basic morphological operationsBasic morphological operations

►erosion erosion

►dilation dilation

►combine tocombine to openingopening closeningclosening

keep general shape but smooth with respect to• object• background

Page 13: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

ErosionErosion

•Does the structuring element fit the set?

shrink the object

erosion of a set A by structuring element B:all z in A such that B is in A when origin of B=z

ABzBA z |

Page 14: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

ErosionErosion

SE=

Page 15: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

ErosionErosion

SE=

Page 16: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing
Page 17: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

DilationDilation

•Does the structuring element hit the set?

grow the object

dilation of a set A by structuring element B:all z in A such that B hits A when origin of B=z

0ˆ| ABzBA z

Page 18: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

DilationDilation

SE=

Page 19: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

DilationDilation

SE=

Page 20: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing
Page 21: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

notationnotation

BB

if SE is symmetric with respect to its origin

(almost) only symmetric SEs in GW!!

Page 22: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

BABA CC ˆ

DualityDuality

erosion and dilation are dual with respect to complementation and

reflection

note! the operations are not self dual

Page 23: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

A A⊖B (A⊖B)C

AC AC⊕B

BB ˆ

Page 24: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

usefuluseful

►erosionerosion removal of structures of certain shape and removal of structures of certain shape and

size, given by SEsize, given by SE

►dilationdilation filling of holes of certain shape and size, filling of holes of certain shape and size,

given by SEgiven by SE

Page 25: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

Combining erosion and dilationCombining erosion and dilation

WANTED:remove structures / fill holes without affecting remaining parts

SOLUTION:combine erosion and dilation (using same SE)

Page 26: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

input:squares of size 1x1, 3x3, 5x5, 7x7, 9x9, and 15x15 pixels

erosion:SE=square of size 13x13

dilation:SE=square of size 13x13

Page 27: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

OpeningOpening

erosion followed by dilation, denoted ∘

• eliminates protrusions• breaks necks• smoothes contour

BBABA

Page 28: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

OpeningOpening B=

A A⊖B A∘B

Page 29: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

OpeningOpening B=

A A⊖B A∘B

Page 30: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

Opening: roll ball(=SE) inside objectOpening: roll ball(=SE) inside object

ABBBA zz |

see B as a ”rolling ball”

boundary of A∘B = points in B that reaches farthest into A when B is rolled inside A

Page 31: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

ClosingClosing

dilation followed by erosion, denoted

• smooth contour• fuse narrow breaks and long thin gulfs• eliminate small holes• fill gaps in the contour

BBABA

Page 32: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

ClosingClosing B=

A A⊕B A B

Page 33: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

ClosingClosing B=

A A⊕B A B

Page 34: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

Closing: roll ball(=SE) outside objectClosing: roll ball(=SE) outside object

0,| ABBwwBA zz

see B as a ”rolling ball”

boundary of AB = points in B that reaches farthest into A when B is rolled outside A

Page 35: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing
Page 36: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

PropertiesProperties

►openingopening A∘B subset/image of AA∘B subset/image of A CCD D C∘B C∘B D∘B D∘B (A∘B)∘B= A∘B(A∘B)∘B= A∘B

►closingclosing A subset/image of AA subset/image of ABB CCD D C CB B D DBB (A(AB)B)B= AB= ABB

Note: idempotent repeated openings/closings has no effect!

Page 37: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

DualityDuality

opening and closing are dual with respect to complementation and

reflection

BABA CC ˆ

Page 38: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

A A∘B (A∘B)C

ACBAC

BB ˆ

Page 39: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

Uselful: open & closeUselful: open & close

A

opening of Aremoval of small protrusions,

thin connections, …

closing of A removal of holes

Page 40: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

Application:Application:filteringfiltering

1. erodeA⊖B

2. dilate(A⊖B)B= A∘B

4. erode((A∘B)B)⊖B=(A∘B)B

3. dilate(A∘B)B

Page 41: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

Hit-or-Miss Transformation Hit-or-Miss Transformation ⊛ ⊛ (HMT)(HMT)

find location of one shape among a set of shapes

”template matching”

composite SE: object part (B1) and background part (B2)

does B1 fits the object while, simultaneously,

B2 misses the object, i.e., fits the background?

Page 42: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

A=XY ZY

X

Z

W W-X

A⊖X

AC⊖(W-X)

A⊛X=(A⊖B1)(Ac⊖B2)

Page 43: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

Hit-or-Miss Transformation Hit-or-Miss Transformation ⊛ ⊛ (HMT)(HMT)

find location of one shape among a set of shapes

W W-X

B=(B1,B2)B1=XB2=W-X

21 BABABA C

XWAXABA C

21 B̂ABABA

Page 44: Mathematical Morphology Lecture 14 Course book reading: GW 9.1-4 Lucia Ballerini Digital Image Processing

use HMTuse HMT

endpoints

isolated pointsB1 B2

B1

B2 B2 B2B2