used to extract image components that are useful in the

97
ee.sharif.edu/~dip E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing Morphological Image processing 1 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

Upload: others

Post on 21-Jan-2022

3 views

Category:

Documents


0 download

TRANSCRIPT

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

1

Digital Image Processing

Morphological Image processing

1

• 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

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

2

Digital Image Processing

Morphological Image processing

2

• 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

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

3

Digital Image Processing

Morphological Image processing

3

• Preliminary:

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

– Reflection:

– Translation:

– Used in Structuring Elements (SEs)

ˆ , for B w w b b B

, for z

B c c b z b B

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

4

Digital Image Processing

Morphological Image processing

4

• Reflection and Translation by examples:

– Need for a reference point.

Reference point

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

5

Digital Image Processing

Morphological Image processing

5

• Structuring Elements:

– Used to structure the objects: • 1 (or balck): Action

• 0 (or white): No Action

• × : Don’t Care

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

6

Digital Image Processing

Morphological Image processing

6

• Example:

– An image

– A structural element

– A processing

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

7

Digital Image Processing

Morphological Image processing

7

• Two Fundamental Morphological Operators:

– Erosion

– Dilation

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

8

Digital Image Processing

Morphological Image processing

8

• Erosion: – Set B: A structural elements.

– Other Names: Shrink, Reduce

z

c

z

A B z B A

A B z B A

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

9

Digital Image Processing

Morphological Image processing

9

• Erosion Example:

z

A B z B A

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

10

Digital Image Processing

Morphological Image processing

10

• Erosion by example (1):

– B: a 3×3 mask (Full).

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

11

Digital Image Processing

Morphological Image processing

11

• Erosion by example (2):

Disk: 11 pixels (Diameter)

Square: 9*9

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

12

Digital Image Processing

Morphological Image processing

12

• Erosin by Example (3):

– Applied on white area

Original 11×11

45×45 15×15

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

13

Digital Image Processing

Morphological Image processing

13

• Dilation:

– Set B: A structural elements.

– Other Names: Grow, Expanding

– Relation to Convolution mask: • Flipping

• Overlapping

ˆ

ˆ

z

z

A B z B A

A B z B A A

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

14

Digital Image Processing

Morphological Image processing

14

• Dilation by example: ˆz

A B z B A

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

15

Digital Image Processing

Morphological Image processing

15

• Dilation by example (1):

– B: a 3×3 mask (full).

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

16

Digital Image Processing

Morphological Image processing

16

• Application:

– Gap filling

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

17

Digital Image Processing

Morphological Image processing

17

• Dilation-Erosion Duality:

ˆ

ˆRemember:

ccc c

z z

c c

z

z

A B z B A z B A

z B A A B

A B z B A

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

18

Digital Image Processing

Morphological Image processing

18

• Erosion Application:

– Remove details

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

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

19

Digital Image Processing

Morphological Image processing

19

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

– Opening: • Smooth contour

• Break narrow isthmuses ( تنگه)

• Eliminates thin protrusion ( بیرون زدگی)

– Closing: • Smooth contour

• Fuse narrow breaks, and long thin gulfs.

• Eliminates small holes, and fill gaps.

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

20

Digital Image Processing

Morphological Image processing

20

• 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

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

21

Digital Image Processing

Morphological Image processing

21

• Opening Illustration:

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

22

Digital Image Processing

Morphological Image processing

22

• Opening Example:

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

23

Digital Image Processing

Morphological Image processing

23

• Closing Illustration:

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

24

Digital Image Processing

Morphological Image processing

24

• Closing Example:

Disk

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

25

Digital Image Processing

Morphological Image processing

25

• Closing Example:

Original Thresholded Closing

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

26

Digital Image Processing

Morphological Image processing

26

• Opening and Closing

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

27

Digital Image Processing

Morphological Image processing

27

• Medical Application:

Original Segmentation

Opening 5×5

Closing 5×5

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

28

Digital Image Processing

Morphological Image processing

28

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 AB

– If C is a subset of D, then CB is a subset of DB

– (AB)B = AB ↔ Multiple apply has no effect.

ˆc cA B A B

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

29

Digital Image Processing

Morphological Image processing

29

Opening

Dilation of Opening Closing of Opening

• Noise

Reduction

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

30

Digital Image Processing

Morphological Image processing

30

• 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 D A W D

A B A B A B

A B A B A B

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

31

Digital Image Processing

Morphological Image processing

31

• Hit-or-Miss:

– Another application: • Corners

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

32

Digital Image Processing

Morphological Image processing

32

• Morphological Operator Applications:

– Boundary Extraction:

A A A B

Eroded Difference

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

33

Digital Image Processing

Morphological Image processing

33

• Boundary Extraction:

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

34

Digital Image Processing

Morphological Image processing

34

• Hole/Region Filling:

– Start form p inside boundary.

0

1

1

, 1, 2,3,

Until:

c

k k

k k

X p

X X B A k

X X

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

35

Digital Image Processing

Morphological Image processing

35

• Region Filling Example:

– Semi-automated to cancel reflection effect

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

36

Digital Image Processing

Morphological Image processing

36

• Connected components Extraction:

– Start from p belong to desired region.

0

1

1

1,2,3,

Until:

k k

k k

X p

X X B A k

X X

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

37

Digital Image Processing

Morphological Image processing

37

• Example (1):

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

38

Digital Image Processing

Morphological Image processing

38

Original

Thr

Erosion (5×5)

Connected Components with size

• Example (2)

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

39

Digital Image Processing

Morphological Image processing

39

• Convex Hull:

– Convex Set:

– Convex Hull: Smallest Convex set H, containing S

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

0

1

4

1

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

,

i

i i i

k k

i i i

i

X A

X X B A i k

C A D D X

converged

, , 0,1 : 1s t s t S S

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

40

Digital Image Processing

Morphological Image processing

40

C: Converged

C C

C C

• Example:

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

41

Digital Image Processing

Morphological Image processing

41

• Shortcoming of previous algorithm:

– Grow more than minimum required convex size.

– Limit to vertical-horizontal expansion.

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

42

Digital Image Processing

Morphological Image processing

42

• Thinning:

1 2

1 2

1

2

Another approach:

, , ,

One Pass with

One Pass with

...

One Pass with

Repeat until convergence

c

n

n

n

A B A A B A A B

B B B

A A B B B

B

B

B

B

B

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

43

Digital Image Processing

Morphological Image processing

43

Convert to m-connection

• Example:

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

44

Digital Image Processing

Morphological Image processing

44

• Thickening:

– Structural elements are as before (1 and 0 interchange).

– Usually thin the background, then complement the results.

1 2 n

A B A A B

A A B B B

B

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

45

Digital Image Processing

Morphological Image processing

45

• 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.

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

46

Digital Image Processing

Morphological Image processing

46

• Skeleton by example:

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

47

Digital Image Processing

Morphological Image processing

47

• Formulation:

0

k=0

, : Opening

: times

K=max k

Reconstruction:

A=

: times

k

k

k

k

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

S A kB S A B B B k

K

K

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

48

Digital Image Processing

Morphological Image processing

48

• Example:

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

49

Digital Image Processing

Morphological Image processing

49

• Pruning:

– Remove Parasitic components (clean-up)

1

8

2 1

1

3 2

4 1 3

k

k

X A

X X B

X X H A

X X X

B

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

50

Digital Image Processing

Morphological Image processing

50

• Example:

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

51

Digital Image Processing

Morphological Image processing

51

• Morphological Reconstruction:

– Until now: An Image and a structuring elements

– Now: Two images and one structuring elements • Marker Image: Starting points for transformation.

• Mask Image: Constrains the transformation

• Structuring element: Define connectivity

– Two main operator:

• Geodesic Dilation

• Geodesic Erosion

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

52

Digital Image Processing

Morphological Image processing

52

• Geodesic Dilation:

– F: Marker Image

– G: Mask Image

– B: Structuring Elements

– Geodesic Dilation of size 1:

– Geodesic Dilation of size n:

– G: Limit the growing nature of dilation by B

1

GD F F B G

1 1 0,

n n

G G G GD F D F D F D F F

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

53

Digital Image Processing

Morphological Image processing

53

• Illustration of Geodesic Dilation:

1

GD F F B G

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

54

Digital Image Processing

Morphological Image processing

54

• Geodesic Erosion:

– F: Marker Image

– G: Mask Image

– B: Structuring Elements

– Geodesic Erosion of size 1:

– Geodesic Erosion of size n:

– G: Results is greater or equal to mask

1

GE F F B G

1 1 0,

n n

G G G GE F E F E F E F F

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

55

Digital Image Processing

Morphological Image processing

55

• Illustration of Geodesic Erosion:

1

GE F F B G

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

56

Digital Image Processing

Morphological Image processing

56

• Morphological Reconstruction:

– By Dilation

1

, :k k kD

G G G GR F D F k D F D F

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

57

Digital Image Processing

Morphological Image processing

57

• Morphological Reconstruction:

– By Erosion

1

, :k k kE

G G G GR F E F k E F E F

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

58

Digital Image Processing

Morphological Image processing

58

• Sample Application:

– Opening/Closing by Reconstruction: • Classical Opening:

– Erosion: Remove small objects

– Subsequent Dilation: Try to restore the shape of objects that remains.

– Restoration in strongly depend on similarity between SE and that objects.

• Restore exactly the shapes of the remained objects after erosion.!

• Opening Reconstruction of size n, we use F as mask

n D

R F

n E

R F

O F R F nB

C F R F nB

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

59

Digital Image Processing

Morphological Image processing

59

• Example:

– Opening Reconstruction:

• Goal: Extract Characters with long vertical strokes

• B: 51×1

Original Erosion

Opening 1

FO F

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

60

Digital Image Processing

Morphological Image processing

60

• Fully Automated Filling Hole Procedure:

– I(x,y): Binary Image

– F(x,y): Marker image that is 0 everywhere except borders

1 , , is on the border of ,

0 otherwise

c

cD

I

I x y x y IF x y

H R F

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

61

Digital Image Processing

Morphological Image processing

61

• Example For Illustration:

– B: A full 3×3 mask

1

1, :

c

c c c c

c

c

I

k k kD

I I I I

cD

I

D F F B I

R F D F k D F D F

H R F

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

62

Digital Image Processing

Morphological Image processing

62

• Practical Example:

I Ic

F H

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

63

Digital Image Processing

Morphological Image processing

63

• Border Clearing:

– Goal: Remove objects that touch (connected to) the border

1 , , is on the border of ,

0 otherwise

D

I

I x y x y IF x y

X I R F

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

64

Digital Image Processing

Morphological Image processing

64

• Example For Illustration:

– B: A full 3×3 mask

1

1, :

I

k k kD

I I I I

D

I

D F F B I

R F D F k D F D F

X I R F

D

IR F

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

65

Digital Image Processing

Morphological Image processing

65

• Summary of Morphological Tools:

– Figure 9.33 and Table 9.1 (Pages 662-664)

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

66

Digital Image Processing

Morphological Image processing

66

• Gray-Scale Morphoogy

– f(x,y): The input gray-scale image

– b(x,y): a structuring element (a subimage function)

– (x,y): 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)

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

67

Digital Image Processing

Morphological Image processing

67

• Two Types of Structuring Elements:

– Non-flat

– Flat

• Mostly used:

– Flat SE

– Symmetrical

Horizontal Intensity Profile Through the center

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

68

Digital Image Processing

Morphological Image processing

68

• Erosion and Dilation:

– Erosion • Flat SE with origin in centered at (x,y)

• Similar to correlation procedure

– Dilation • Flat reflected SE with origin in centered at (x,y),

• Similar to Convolution procedure

,

, min ,s t b

f b x y f x s y t

,

, ,s t b

f b x y Max f x s y t

ˆ , ,b x y b x y

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

69

Digital Image Processing

Morphological Image processing

69

• Example:

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

70

Digital Image Processing

Morphological Image processing

70

• Erosion and Dilation:

– Erosion • Non-Flat SE with origin in centered at (x,y)

• Similar to correlation procedure

– Dilation • Non-Flat reflected SE with origin in centered at (x,y),

• Similar to Convolution procedure

,

, min , ,N

N Ns t b

f b x y f x s y t b s t

,

, max , ,N

N Ns t b

f b x y f x s y t b s t

ˆ , ,b x y b x y

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

71

Digital Image Processing

Morphological Image processing

71

• Dilation Similarity with Convolution: – f (x-s,y-t): is simply mirrored version of f (x,y) with respect

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

– 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.

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

72

Digital Image Processing

Morphological Image processing

72

• 1D example:

max ( ) ( )N

Ns b

f b x f x s b x

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

73

Digital Image Processing

Morphological Image processing

73

• Erosion similarity to 2D correlation

– f (x+s,y+t) moves to the left for positive s-t and to the right for negative s-t.

• 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.

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

74

Digital Image Processing

Morphological Image processing

74

• 1D Example:

minN

N Ns b

f b x f x s b s

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

75

Digital Image Processing

Morphological Image processing

75

• Erosion-Dilation Duality:

– For flat and non-flat SE:

ˆ , ,

ˆ , ,

ˆ( , ) and ( , )

c c

c c

c

f b x y f b x y

f b x y f b x y

f f x y b b x y

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

76

Digital Image Processing

Morphological Image processing

76

• Dilation-Erosion by Example:

Original Dilation

Erosion

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

77

Digital Image Processing

Morphological Image processing

77

• Opening-Closing:

– Same (binary) relation with Dilation-Erosion:

ˆ

ˆ

c c

c c

f b f b b

f b f b b

f b f b

f b f b

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

78

Digital Image Processing

Morphological Image processing

78

• Opening/Closing 1D Example:

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

79

Digital Image Processing

Morphological Image processing

79

• Opening-Closing Properties:

– Opening:

– Closing:

1 2 1 2

( )

( ) if , then ,

( )

i f b f

ii f f f b f b

iii f b b f b

1 2 1 2

( )

( ) if , then

( )

i f f b

ii f f f b f b

iii f b b f b

er 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

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

80

Digital Image Processing

Morphological Image processing

80

• 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 the image.

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

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

81

Digital Image Processing

Morphological Image processing

81

• Opening Closing Example (1)

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

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

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

82

Digital Image Processing

Morphological Image processing

82

• Opening and Closing Example (2):

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

83

Digital Image Processing

Morphological Image processing

83

• 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

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

84

Digital Image Processing

Morphological Image processing

84

• Morphological Smoothing:

– Opening

– Closing

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

85

Digital Image Processing

Morphological Image processing

85

• Morphological Gradient:

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

86

Digital Image Processing

Morphological Image processing

86

• Top-hat and Bottom-hat Transforms:

hat

hat

T f f f b

B f f b f

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

87

Digital Image Processing

Morphological Image processing

87

• Example:

Original Thresholding

Opening

Top-hat

Thresholding

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

88

Digital Image Processing

Morphological Image processing

88

• Granulometry:

– Determine size distribution of particles in an image.

– Apply opening with SE’s on increasing size.

– Calculate sum of pixel values in the opening.

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

89

Digital Image Processing

Morphological Image processing

89

• Example:

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

90

Digital Image Processing

Morphological Image processing

90

• Example (Cont.):

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

91

Digital Image Processing

Morphological Image processing

91

• Textural Segmentation:

– Two different texture in an image

– Goal: Find Boundary between them.

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

92

Digital Image Processing

Morphological Image processing

92

• Gray-Scale Morphological Reconstruction:

– f: Marker Image

– g: Mask Image

– Same size and f ≤ g

– ˄: Point-wise minimum operator

– ˅: Point-wise maximum operator

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

93

Digital Image Processing

Morphological Image processing

93

• Geodesic Dilation of size 1:

• Geodesic Dilation of size n:

1

gD f f b g

1 1 0,

n n

g g g gD f D f D f D f f

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

94

Digital Image Processing

Morphological Image processing

94

• Geodesic Erosion of size 1:

• Geodesic Srosion of size n:

1

gE f f b g

1 1 0,

n n

g g g gE f E f E f E f f

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

95

Digital Image Processing

Morphological Image processing

95

• Morphological Reconstruction:

– By Erosion

– By Dilation

1, :

k k kE

g g g gR f E f k E f E f

1, :

k k kD

g g G GR f D f k D f D f

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

96

Digital Image Processing

Morphological Image processing

96

• Opening/Closing by Reconstruction:

n D

R f

n E

R f

O f R f nb

C f R f nb

ee.sharif.edu/~dip

E. Fatemizadeh, Sharif University of Technology, 2011

97

Digital Image Processing

Morphological Image processing

97

• Example: