image segmentation - sjtubcmi.sjtu.edu.cn/~luhongtao/dip/res/dip10-sut.pdf · digital image...

72
Digital Image Processing, 2nd ed. Digital Image Processing, 2nd ed. © 2002 R. C. Gonzalez & R. E. Woods Chapter 10 Image Segmentation Chapter 10 Image Segmentation Image Segmentation: – Definition – Importance

Upload: others

Post on 15-Jul-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Image Segmentation:– Definition

– Importance

Page 2: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Detection of Discontinuities:

9

1i i

i

R w z=

=∑

Page 3: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

R T≥• Point Detection:

1. A Mask

2. Thresholding

Page 4: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Line Detection:– A Suitable Mask in desired direction

– Thresholding: ,i jLine i R R j≥ ∀

Page 5: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Example:

Thresholding-45º Mask

Page 6: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Edge Detection:– Two Mathematical model

Page 7: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

f

x

∂∂

2

2

f

x

∂∂

Page 8: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

( )0,0N

( )0,0.1N

( )0,1N

( )0,10N

f

x

∂∂

2

2

f

x

∂∂

f

• Noise Problem:

Page 9: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Gradient Operators:

( )

1 222

1, tan

x

y

y

x

fG x

ffG

y

f f f ff

x y x y

Gx y

∂ ∂ ∇ = = ∂ ∂ ∂ ∂ ∂ ∂ ∇ = + → + ∂ ∂ ∂ ∂

=

Page 10: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Gradient Operators:– Roberts Cross Gradients:

– Prewitt Operators:

( ) ( )

( ) ( )9 5 8 6

1 22 2

9 5 8 6

9 5 8 6 :

x yG z z G z z

f z z z z

f z z z z Roberts Cross Gradient

= − = −

∇ ≈ − + − ∇ ≈ − + − −

( ) ( )( ) ( )

( ) ( )( ) ( )

7 8 9 1 2 3 7 8 9 1 2 3variation

3 6 9 1 4 7 3 6 9 1 4 7

2 2

2 2

x x

y y

G z z z z z z G z z z z z z

G z z z z z z G z z z z z z

= + + − + + = + + − + + → = + + − + + = + + − + +

Page 11: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

Gradients Operators

Y-Direction X-Direction

Page 12: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

Diagonal Edge

45-Direction -45-Direction

Page 13: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

OriginalxG

yG x yG G+

Page 14: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

OriginalxG

yG x yG G+

Pre-Smoothing

5×5

Page 15: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

0 1 2

1 0 1

2 1 0

− − − 2 1 0

1 0 1

0 1 2

− − − 45º and -45º lines

Page 16: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Laplacian as an isotropic Detector:

• Discrete Implementation:

2 22

2 2

f ff

x y

∂ ∂∇ = +∂ ∂

( )( )

25 2 4 6 8

25 1 2 3 4 6 7 8 9

4N's: 4

8N's: 4

f z z z z z

f z z z z z z z z z

∇ = − + + +

∇ = − + + + + + + +

Page 17: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

2

2

2 2 22

4 2

( ) exp2

( ) exp2

rh r

r rh r

σ

σσ σ

= − − −∇ = − − • Laplacian of Gaussian (LoG):

Page 18: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

OriginalSobel

GLPF Laplacian

LoG LoG>T ZC Zero Crossing:

•Thinner Edge

•Easy to compute

•Noise Reduction capability

•Spaghetti Effect (isolated circles)

Page 19: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

( ) ( )( ) ( )

0 0

0 0

, ,

, ,

f x y f x y E

x y x y Aα α

∇ − ∇ ≤

− ≤

xG

yG

• Edge Linking (Local Processing)

Results

Input

Page 20: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Global Edge Linking by the Hough Transform:

( )

( ) ( )

, &

All , 's on a line intersect each other at a,b

i i i i

i i

i i

x y y ax b y ax b

b x a y

x y

= + ⇒ = += − +

Page 21: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Hough Transform in Cartesian

( )1 11 11 11 1x ,yx ,yx ,yx ,y

( )2 22 22 22 2x ,yx ,yx ,yx ,y

( )3 33 33 33 3x ,yx ,yx ,yx ,y( )4 44 44 44 4x ,yx ,yx ,yx ,y

( )a,ba,ba,ba,b

Page 22: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Hough Transform in Polar– Problem with Vertical line (a=∞)( )( )

( ) ( )

, & cos sin cos sin

,

All , 's on a sin intersect each other at ,

i i i i

i i

i i i i

x y x y x y

x y

θ θ ρ θ θ ρρ θ

ρ θ

+ = ⇒ + =

Page 23: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

Page 24: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Hough Transform

Page 25: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Hough Transform for circle:

• Extract each circle (independent of radius):

( ) ( ) ( ) ( ) ( )( ) ( )

2 2 2 22 21 2 3 1 2 3

1 2 3

, &

All , 's on a spherical surface intersect each other at , ,

i i i i

i i

x y x p y p p x p y p p

x y p p p

− + − = ⇒ − + − =

1 12 1

2 2

cos costan tan

sin sini i

i ii i

x p r p x rp p x y

y p r p y r

θ θθ θ

θ θ= + = − ⇒ ⇒ = − + = + = −

Page 26: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Hough Transform for circle:

Page 27: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Hough Transform for circle:

Page 28: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Hough Transform Implementation:– Discrete Accumulator

• Smoothing

• Find Local Maxima

1

1

1

21

12

15

22

111

Page 29: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

Original Thr-Grad.

H-TLinked

Page 30: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Thresholding:– F(x,y)>T then (x,y) is belong to object, else (x,y) is belong

to background.• Bi-level (T)

• Multi-level (T1,T2,…, Tn)

• Threshold image:

– Threshold Estimation :• Histogram

( ) ( )( )

1 ,,

0 ,

f x y Tg x y

f x y T

>= ≤

Page 31: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

Thresholds

Page 32: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Role of illumination

• Histogram Distortion

• Broadness• Homomorphic Process

( ) ( ) ( ), , ,f x y i x y r x y=

( ),r x y

( ),i x y( )rP r

( ) ( ), ,i x y r x y ( )fP f

( ) ( ) ( )( ) ( )( ) ( ) ( )

, , ,

, ln ,

, , ,

f x y i x y r x y

z x y f x y

z x y i x y r x y

=

=′ ′= +

Page 33: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Basic Global Thresholding:

min

2

MAXT

+=

Page 34: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• How to select T:– A Heuristic approach:

1. Initial guess on T

2. Segment image to G1(>T) and G2(≤T)

3. Compute average value of G1(Ψ1) and G2(Ψ2)

4. Set T be average of Ψ1 andΨ2

5. Repeat 2-4 until small changed in successive T values.

Page 35: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

Convergence0 1250 .4fT T= → =

Page 36: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Adaptive Thresholding:– Local Thresholding:

• Subdivide the images into smaller block.

– Optimal Global Thresholding:• Determine best value when no evidence valley.

Page 37: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

Global Thr.

Local Thr.Mosaic

Page 38: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

Good Subimage

Bad Subimage

• Sub-image selection effect

Further block-ing

Page 39: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

( )( ) ( )

( )

2 21 22 21 22 2

1 2

2

2 21 2

2 21 2 2 1

2 2 2 2 2 2 1 21 2 2 1 1 2

2 1

22 2 1 2 21 2

1 2 2

exp exp

0

2

2 ln

for ln2

z z

P z P P

AT BT C

A

B

PC

P

PT

P

µ µσ σ

σ σ

µ σ µ σ

σσ µ σ µ σ σσ

µ µ σσ σµ µ

− −− −

= +

∴ + + == −

= − = − + += ⇒ = + −

• Optimal Global-Adaptive Thresholding:– Gaussian Histogram

Page 40: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

( ) ( ) ( )

( ) ( )

( ) ( )

1 1 2 2

1 2

2 1 1 2

1 1 2 2

1

minT

TT

p z P p z P p z

P P

P p z dz P p z dz

P p T P p T

+∞

−∞

= ++ =

+ ∴ =

∫ ∫

• Optimal Global-Adaptive Thresholding:– Histogram Modeling

Page 41: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Example:– Preprocessing

• Log function( radiological absorption)

• Digital Subtraction (Pre and Post images)

• Image summation in order to reduce noise.

Before After

Page 42: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Example:– Optimal Thresholding:

• Subdivide images to 7×7 sub-block (50% overlap)

• Histogram Estimation

• Test of bimodality and Gaussian fitting and …

BimodalUnimodal

Page 43: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Example:– Thresholding

– Segmentation

– Boundary Detection

– Superimposing

Page 44: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• How to improve the former methods:– Consider pixels near boundary for histogram.

– Use of gradient/Laplacian to estimate boundary:

– 0: Not on Edge

– +1:Dark side of edge

– -1: Bright side of edge

( ) 2

2

0

, 1 and 0

1 and 0

f T

S x y f T f

f T f

∇ <= + ∇ ≥ ∇ ≥− ∇ ≥ ∇ <

Page 45: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Example:

Page 46: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

Histogram of Gradient

(Those with G>5)

S(x,y) with T=midpoint

Page 47: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Segmentation with Multiple Variables:– RGB/Multi-Channel data

– Cluster of point in 3D

Original (Color) Facialtones REDchannel

Page 48: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Region Based Segmentation:

( )( )

1

are connected regions.

,

TRUE

FALSE

n

ii

i

i j

i

i j

R

R

R R i j

P R

P R R

=

• = ∅ ≠

• =

• =

Page 49: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Region Growing:– Select a start (seed) point

– Grow the point based on a certain property• Connectivity should be considered.

– Seed point selection:• Handy

• Highlighted point (Due to specific property)

Page 50: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Region Growing:

Page 51: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Region Growing (Example):– Determine seed points to maximum gray level.

– Growing criteria:• Gray level value difference (with respect to S.P.) less

than a threshold.

• Each candidate pixel should be N8 of region.

Page 52: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Region Growing: Seed Point High Value (255) Points

Page 53: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Multimodal Histogram

Threshold

Page 54: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Splitting and Merging:– Define a criteria for each region to be a valid

segment.

– Split each region which is not satisfy the criteria.

– Merge two neighbor region based on criteria.

Page 55: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Splitting and Merging

Page 56: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Splitting-Merging Algorithm– Criteria:

• 80% of all pixels satisfy: 2j i iz m σ− ≤

Page 57: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

Page 58: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

Page 59: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

Page 60: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

Page 61: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

Page 62: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

Page 63: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• The Use of Motion in Segmentation:– Spatial Domain

– Frequency Domain

• Spatial Domain:– Main idea: Compare pixel by pixel (difference)

( ) ( ) ( ) Dynamic Objec1 , , , ,,

0 O.W

t

Static Object.

i jij

f x y t f x y t Td x y

− > →=

Page 64: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Accumulative Difference Image (ADI):– Consider and as reference

frame. – ADI compare reference frame with incoming frame.– Increment counter of each pixel when a difference

detected.

– ADI alternative:• Absolute• Positive• Negative

( ){ }1

, ,n

i if x y t

=( )1, ,f x y t

Page 65: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Accumulative Difference Image (ADI):

( ) ( ) ( ) ( )( )

( ) ( ) ( ) ( )( )

( ) ( ) ( ) ( )( )

1 1

1

1 1

1

1 1

1

, 1 , , , ,,

, O.W.

, 1 , , , ,,

, O.W.

, 1 , , , ,,

, O.W.

k k

k

k

k k

k

k

k k

k

k

A x y f x y t f x y t TA x y

A x y

P x y f x y t f x y t TP x y

P x y

N x y f x y t f x y t TN x y

N x y

+ − >= + − > = + − < − =

Page 66: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• ADI Example

Absolute Positive Negative

Page 67: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Establishing a Reference Images:– Difference will erase static object:

• When a dynamic object move out completely from its position, the back ground in replaced.

Page 68: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Frequency Domain Methods:– A Static/black background

– A Dynamic single pixel

( ) ( )

( ) ( )

( ) ( )

( ) ( )

1

2

1

2

1 12

10 0

1 12

20 0

12 /

1 1 1 10

12 /

2 1 20

, , , , 0,1,2, , 1

, , , , 0,1,2, , 1

1, , , 0,1,2, , 1

1, , , 0,1

M Nj a x t

xx y

N Mj a y t

yy x

Kj u t K

x xt

Kj u t K

y y yt

g t a f x y t e t K

g t a f x y t e t K

G u a g t a e u KK

G u a g t a e uK

π

π

π

π

− −∆

= =

− −∆

= =

−−

=

−−

=

= = − = = −

= = −

= =

∑ ∑∑ ∑∑∑

⋯⋯⋯1 1 1 2 2 2

, 2, , 1

,

K

u a v u a v

= =

Page 69: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• An Example:

Page 70: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

• Intensity Plot

Page 71: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation

Page 72: Image Segmentation - SJTUbcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP10-SUT.pdf · Digital Image Processing, 2nd ed. ... Image Segmentation • How to improve the former methods: – Consider

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed. www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 10Image Segmentation

Chapter 10Image Segmentation