73
Digital Image Processing, 2nd ed. Digital Image Processing, 2nd ed. www.imageprocessingbook.com © 2002 R. C. Gonzalez & R. E. Woods Chapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing Used to extract image components that are useful in the representation and description of region shape, such as – boundaries extraction – skeletons – convex hull – morphological filtering – thinning – pruning

• Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Used to extract image components that are useful in the representation and description of region shape, such as – boundaries extraction– skeletons– convex hull– morphological filtering– thinning– pruning

Page 2: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Sets in mathematic morphology represent objects in an image:– binary image (0 = white, 1 = black) : the element

of the set is the coordinates (x,y) of pixel belong to the object Z2

– gray-scaled image : the element of the set is the coordinates (x,y) of pixel belong to the object and the gray levels Z3

Page 3: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Preliminary:• A: A set in Z2 with elements of a=(a1,a2)

{ }{ },

c

c

a Aa AA BC A BD A BA B

A w w A

A B w w A w B A B

• ∈• ∉• ⊆• =• =• =∅

• = ∉

• − = ∈ ∉ =

∪∪

Page 4: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Operators by examples:

Page 5: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Preliminary:• A: A set in Z2 with elements of a=(a1,a2)

{ }( ) { }ˆ , for , Reflection

, for , Translationz

B w w b b B

A c c a z a A

• ∈ = − ∈

• ∈ = + ∈

Page 6: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Reflection and Translation by examples:– Need for a reference point.

Reference point

Page 7: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Basic Logic Operations:

Page 8: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Examples

Page 9: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Two Fundamental Morphological Operators:– Dilation:

• Set B: A structural elements.• Relation to Convolution mask:

– Flipping– Overlapping

• Other names: Grow, Expand

( ){ } ( ){ }ˆ ˆz z

A B z B A z B A A⊕ = ≠ ∅ = ⊆∩ ∩

Page 10: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Dilation by example:

Page 11: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Dilation by example:– B: a 3×3 mask.

Page 12: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Application:– Gap filling

Page 13: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Two Fundamental Morphological Operators:– Erosion:

• Set B: A structural elements.• Other banes: Shrink, Reduce

( ){ }zA B z B A= ⊆

Page 14: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

( ){ }zA B z B A= ⊆

Page 15: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Erosion by example:– B: a 3×3 mask.

Page 16: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Erosion by example:

11 pixels (Diameter)

Page 17: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Dilation-Erosion Duality:

( ) ( ){ } ( ){ }( ){ }

( ){ }ˆ

ˆRemember:

ccc cz z

c cz

z

A B z B A z B A

z B A A B

A B z B A

= ⊆ = =∅

= ≠ ∅ = ⊕

⊕ = ≠ ∅

Page 18: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Erosion Application:– Remove details

1,3,5,7,9, and 15 Erode with 13 Dilate with 13

Page 19: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Opening and Closing:– Dilation expands and Erosion shrinks.– Opening:

• Smooth contour• Break narrow isthmuses (Means: تنگه(• Remove thin protrusion

– Closing:• Smooth contour• Fuse narrow breaks, and long thin gulfs.• Remove small holes, and fill gaps.

Page 20: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Opening and Closing:– Dilation expands and Erosion shrinks.– Opening:

• A erosion followed by a dilation using the same structuring element for both operations.

– Closing:• A Dilation followed by a erosion using the same

structuring element for both operations.

( ) ( ) ( ){ }z zA B A B B B B A= Θ ⊕ = ⊆∪

( )A B A B B= ⊕ Θ

Page 21: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Opening Illustration:

Page 22: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Opening Illustration:

Page 23: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Closing Illustration:

Page 24: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Closing Illustration:

Page 25: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Opening and Closing

Page 26: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Medical Application:

Original Segmentation

Opening 5×5

Closing 5×5

Page 27: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Opening and Closing Duality:

• Opening Properties:– A○B is a subset (subimage) of A– If C is a subset of D, then C○B is a subset of D○B– (A○B)○B = A○B ↔ Multiple apply has no effect.

• Closing Properties:– A is a subset (subimage) of A•B– If C is a subset of D, then C•B is a subset of D•B– (A•B)•B = A•B ↔ Multiple apply has no effect.

( ) ( )ˆc cA B A B• =

Page 28: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

Opening

Dilation of Opening Closing of Opening

• NoiseReduction

Page 29: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Hit-or-Miss– Shape Detection– X-Y-X shape– X enclosed by W

– B1: Object related– B2: Background related

( ) ( )( )

( ) ( )1 2

1 2

*

*

ˆ*

c

c

A B A X A W X

A B A B A B

A B A B A B

⎡ ⎤= Θ Θ −⎣ ⎦⎡ ⎤= Θ Θ⎣ ⎦

= Θ − ⊕

Page 30: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Hit-or-Miss:– Another application:

• Corners

Page 31: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Morphological Operator Applications:– Boundary Extraction:

( ) ( )A A A Bβ = − Θ

Eroded Difference

Page 32: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Boundary Extraction:

Page 33: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Region Filling:– Start form p inside boundary.

( )0

1Until:

ck k

k k

X p

X X B AX X+

=

= ⊕

=

Page 34: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Region Filling Example:– Semi-automated to cancel reflection effect

Page 35: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Connected components Extraction:– Start from p belong to desired region.

( )0

1Until: k k

k k

X pX X B A

X X+

=

= ⊕

=

Page 36: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

Original

Thr

Erosion (5×5)

Connected Components with size

Page 37: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Convex Hull of S:– Smallest Convex set H, containing S

• Define Four basic structural elements, Bi, i=1,2,3,4

( )( )

0

4

1

1, 2,3,4 and 1, 2,3,

,

i

i i ik k

i i iconverged

i

X A

X X B A i k

C A D D X=

• =

• = ∗ = =

• = =

Page 38: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

Converged: C

C

C C

C C

Page 39: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Shortcoming of previous algorithm:– Grow more than minimum required convex size.– Limit to vertical-horizontal expansion.

Page 40: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Thinning:( ) ( )

{ } { }{ } ( )( )( )( )

1 2

1 2

* *Another approach:

, , ,

Repeat until convergence

c

n

n

A B A A B A A B

B B B

A A B B B

⊗ = − =

=

⊗ = ⊗ ⊗ ⊗

B

B

Page 41: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

Convert to m-connection

Page 42: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Thickening:

• Structural elements are as before.

( )

{ } ( )( )( )( )1 2

*n

A B A A B

A A B B B

=

=B

Page 43: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Skeletonization A with notation S(A):– For z belong to S(A) and (D)z, the largest disk

centered at z and contained in A, one can not find a larger disk containing (D)z and included in A.

– Disk (D)z touches the boundary of A at two or more different points.

Page 44: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Skeleton by example:

Page 45: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Formulation:( ) ( )

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

( ){ }

( )( )

( ) ( )( )( )( )

0

K

k=0

, : Opening

: times

K=max k

Reconstruction:

A=

: times

K

kk

k

k

S A S A

S A A kB A kB B

A kB A B B B k

A kB

S A kB

A kB A B B B k

=

=

= Θ − Θ

Θ = Θ Θ Θ

Θ ≠∅

⊕ = ⊕ ⊕ ⊕

Page 46: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

Page 47: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

Page 48: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

Page 49: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

Page 50: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

Page 51: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

Page 52: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

Page 53: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Extension to Gray-Level images:– f(x,y): the input image – b(x,y): a structuring element (a subimage function)– (x,y) are integers.– f and b are functions that assign a gray-level value

(real number or real integer) to each distinct pair of coordinate (x,y)

Page 54: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Extension to Gray-Level images:– Dilation:

• Df and Db are the domains of f and b, respectively.

• condition (s-x) and (t-y) have to be in the domain of fand (x,y) have to be in the domain of b is similar to the condition in binary morphological dilation where the two sets have to overlap by at least one element

( )( , ) max{ ( , ) ( , ) |( ), ( ) ; ( , ) }f b

f b s t f s x y t b x ys x t y D x y D

⊕ = − − +− − ∈ ∈

Page 55: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Dilation Similarity with Convolution:– f(s-x) : f(-x) is simply f(x) mirrored with respect to the

original of the x axis. the function f(s-x) moves to the right for positive s, and to the left for negative s.

– Max operation replaces the sums of convolution – Addition operation replaces with the products of

convolution.• General effect

– If all the values of the structuring element are positive, the output image tends to be brighter than the input

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

Page 56: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• 1D example:( )( ) max{ ( ) ( ) | ( ) ; }f bf b s f s x b x s x D x D⊕ = − + − ∈ ∈

Page 57: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Erosion:

Condition (s+x) and (t+y) have to be in the domain of f and (x,y) have to be in the domainof b is similar to the condition in binary morphological erosion where the structuring element has to be completely contained by the set being eroded.

( )( , ) min{ ( , ) ( , ) |( ), ( ) ; ( , ) }f b

f b s t f s x y t b x ys x t y D x y D

Θ = + + −+ + ∈ ∈

Page 58: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Similarity to 2D correlation– f(s+x) moves to the left for positive s and to the

right for negative s.• General effect

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

– The effect of bright details in the input image that are smaller in area than the structuring element is reduced, with the degree of reduction being determined by the gray-level values surrounding the bright detail and by the shape and amplitude values of the structuring element itself.

Page 59: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• 1D case:( )( ) min{ ( ) ( ) |

( ) ; }f b

f b s f s x b xs x D x D

Θ = + −+ ∈ ∈

Page 60: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Erosion-Dilation Duality:

ˆ( ) ( , ) ( )( , )where

ˆ( , ) and ( , )

c c

c

f b s t f b s t

f f x y b b x y

Θ = ⊕

= − = − −

Page 61: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Dilation-Erosion

Original

Dilation

Erosion

Page 62: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Opening-Closing:– Same (binary) relation with Dilation-Erosion:

( )( )

ˆ( )c c

f b f b bf b f b b

f b f b

= − ⊕• = ⊕ −

• =

Page 63: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• 1D Example:One scan line

Rolling ball for opening

Opening results

Rolling ball for Closing

Closing Results

Page 64: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Opening-Closing Properties:– Opening:

– Closing:

1 2 1 2

( ) ( )( ) if , then ( ) ( ),( ) ( ) ( )

i f b fii f f f b f biii f b b f b

↵↵ ↵

=

1 2 1 2

( ) ( )( ) if , then ( ) ( )( ) ( ) ( )

i f f bii f f f b f biii f b b f b

↵ •↵ • ↵ •• • = •

e↵r indicates that the domain of e is a subset of the domain of r, and also that e(x,y) ≤ r(x,y) for any (x,y) in the domain of e

Page 65: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Opening– The structuring element is rolled underside the surface of f– All the peaks that are narrow with respect to the diameter of the

structuring element will be reduced in amplitude and sharpness– So, opening is used to remove small light details, while leaving

the overall gray levels and larger bright features relatively undisturbed.

– The initial erosion removes the details, but it also darkens theimage.

– The subsequent dilation again increases the overall intensity ofthe image without reintroducing the details totally removed by erosion.

Page 66: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Closing– The structuring element is rolled on top of the surface

of f– Peaks essentially are left in their original form (assume

that their separation at the narrowest points exceeds the diameter of the structuring element)

– So, closing is used to remove small dark details, while leaving bright features relatively undisturbed.

– The initial dilation removes the dark details and brightens the image

– The subsequent erosion darkens the image without reintroducing the details totally removed by dilation

Page 67: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Opening Closing Example

Opening: Decreased size of small bright details. No changes to dark region

Closing: Decreased size of small dark details. No changes to bright region

Page 68: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Gray Level Morphological Examples:– Smoothing:– Gradient:– Laplacian:

( ) ( )g f b f b= ⊕ − Θ

( ) ( ) 2g f b f b f= ⊕ + Θ −

( )( )g f b b= •

Dilation Erosion Smoothing Gradient Laplacian

Page 69: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Smoothing

Page 70: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Gradient:

Page 71: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

• Top-hat:– Enhancing details in presence of shades

( )h f f b= −

Page 72: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing

Page 73: • Used to extract image components that are useful …bcmi.sjtu.edu.cn/~luhongtao/dip/res/DIP09-SUT.pdfChapter 9 Morphological Image Processing Chapter 9 Morphological Image Processing

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

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

Chapter 9Morphological Image Processing

Chapter 9Morphological Image Processing