Sie sind auf Seite 1von 55

Chapter 9

Morphological Image Processing


IVPL
Preview
ƒ Morphology 型態學
} About the form and structure of animals and plants
ƒ Mathematical morphology
} Using set theory
} Extract image component
} Representation and description of region shape
ƒ Sets in math. Morphology represent objects in
an image
} Example
ƒ Binary image: the elements of a set is the coordinate (x,y) of
the pixels, in Z2
ƒ Gray-level image: the element of a set is the triple, (x, y,
gray-value), in Z3
Basic Concepts
Special set operations for morphology

translation reflection

( A) z = {c c = a + z, for a ∈ A} Bˆ = {w w = −b, for b ∈ B}


Logic Operations
Chapter 9
Morphological Image Processing
Dilation

A⊕ B = { z ( Bˆ ) ∩ A ≠ ∅ }
z
B:structuring
element

像convolution
中filter翻轉
Chapter 9
Morphological Image Processing
Application of dilation:
bridging gaps in images
Structuring
element

max. gap=2 pixels


Erosion 腐蝕

A B = { z ( B ) z ⊆ A} z: displacement
Chapter 9
Morphological Image Processing
Application of erosion:
eliminate irrelevant detail

Squares of size Erode with


1,3,5,7,9,15 pels 13x13 square

original image erosion dilation


Dilation and erosion are duals

( A B ) = { z ( B ) z ⊆ A}
c c

= { z ( B) ∩ A = ∅ }
z
c c

= { z ( B) ∩ A ≠ ∅ }
c

{ }
z
A⊕B = z (Bˆ)z ∩ A ≠ ∅
= A ⊕ Bˆ
c
9.3 Opening and Closing

ƒ Opening – °
A ° B = (A Θ B) ⊕ B.

ƒ Closing - •
A • B = (A ⊕ B) Θ B.

ƒ Duals

( A• B) C
( )
= A o B̂ .
C
Opening
Closing
Chapter 9
Morphological Image Processing
Noisy
image

Remove opening
outer
noise
closing

Remove
inner
noise
Hit-or-miss transformation

ƒ Find the location of certain shape

erosion

Find the set of pixels that


contain shape W
如何只找到相符形狀中心點?
Hit-or-miss transformation (cont.)

Detect object via


background

Erosion
with (W-X)
Hit-or-miss transformation (cont.)

ƒ Eliminate un-necessary parts


9.5 Morphological Algorithms

ƒ Boundary Extraction
ß (A) = A – (A Ө B)
Example 9.5
Region filling

ƒ Idea: place a point inside the region, then


dilate that point iteratively

X0 = p
X k = ( X k −1 ⊕ B ) ∩ Ac , k = 1,2,3,...
Until X k = X k −1

Bound the growth


Region filling (cont.)
Application: region filling

The first filled


region
Original image Fill all regions
Extraction of connected components

ƒ Idea: start from a point in the connected


component, and dilate it iteratively
X0 = p
X k = ( X k −1 ⊕ B ) ∩ A, k = 1,2,3,...
Until X k = X k −1
Extraction of connected components (cont.)
original
雞肉

thresholding

erosion

去除小雜訊
Convex hull

ƒ A set is convex if
} A line join two points in A lies entirely within A
Convex hull (cont.)

ƒ Convex hull of an arbitrary set A


} The smallest convex set containing A

Convex hull

A
Convex hull algorithm

ƒ Idea: find points within line segments

X0 = A B i : structuring elements
X ki = ( X ki −1 * B i ) ∪ A, k = 1,2,3,...
Until X ki = X ki −1
Hit-or-miss trans., no background
match is required = erosion?
C ( A) = ∪ X conv
i
i
Don’t care
Thinning 細化

A⊗ B = A− (A * B)
{B} = {B1 , B 2 , B 3 ,..., B n }
Thinning (cont.)

Convert to m-connectivity
Thickening

A . B = A∪(A * B)
Another method: 1. Thin the background
2. Complement the result

A Ac

thin(Ac)
complement
Skeletons 骨架

Set A Maximum disk


1. The largest disk
Centered at a pixel
2. Touch the boundary
of A at two or more
places
Skeletons : algorithm

ƒ Idea: 不斷的 erosion

K
S ( A) = ∪ Sk ( A)
k =0

Sk ( A) = ( A kB ) − ( A kB ) o B
(A kB ) = (...( A B) B) ...) B
Erosion k 次
K = max{ k ( A kB) ≠ ∅ }
Result is not connected!
Pruning

ƒ Clean up the parasitic components of the


set
} Complement step of thinning and skeletons
ƒ Application: hand-printed character
recognition
} Find skeleton of each character
} Produce spurs during erosion by non-
uniformities in the strokes
1. Detect end
point iteratively
X = A⊗ B
thinning
= A − ( A * B) Detect endpoints

Hit-or-miss

2.

2. Dilate endpoints Final result


Structuring elements
Morphological operations
applied to gray-level images

ƒ f(x,y) ∈ Z: input image


ƒ b(x,y)∈Z: structuring element
Dilation

convolution-like operation
( f ⊕ b)( s, t ) = max{ f ( s − x, t − y ) + b( x, y ) ( s − x, t − y ) ∈ D f ; ( x, y ) ∈ Db }
Dilation (cont.)

1. Image appears brighter


2. Size of dark regions become smaller

original Dilated with 5x5 mask


Erosion

( f - b)( s, t ) = min{ f ( s + x, t + y ) − b( x, y ) ( s + x, t + y ) ∈ D f ; ( x, y ) ∈ Db }
Erosion (cont.)

1. Image appears darker


2. Size of bright regions become smaller

original eroded with 5x5 mask


Opening and closing

ƒ Opening = erosion followed by dilation

f ob = ( f b) ⊕ b
ƒ Closing = dilation followed by erosion

f • b = ( f ⊕ b) b
Opening:
Remove light
sparks

Closing:
Remove dark
holes
Example of opening and closing

opening closing
Morphological smoothing

ƒ Opening+closing
} Remove both light and dark details

original smoothing
Morphological gradient

ƒ Highlight sharp gray-level transition


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

Gradient:
original 無方向性
Top-hat transformation

ƒ Enhance detail in the presence of shading


h = f − ( f o b)

original
Texture segmentation

Closing with circles of different sizes to identify dark circles

original
Granulometry

Opening with circles of different sizes to identify light circles

Das könnte Ihnen auch gefallen