Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 99

Chapter 3: Morphological Image Processing

Preview
 “Morphology “ – a branch in biology that deals with the
form and structure of animals and plants.
 “Mathematical Morphology” – as a tool for extracting
image components, that are useful in the representation
and description of region shape.
 The language of mathematical morphology is – Set theory.
 Unified and powerful approach to numerous image
processing problems.
 In binary images , the set elements are members of the 2-D
integer space – Z2. where each element (x,y) is a coordinate
of a black (or white) pixel in the image.
Mathematic Morphology
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

3
Mathematic Morphology
mathematical framework used for:
pre-processing
noise filtering, shape simplification, ...
enhancing object structure
skeletonization, convex hull...
Segmentation
watershed,…
quantitative description
area, perimeter, ...

4
Z2 and Z3
set 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

5
Basic Concepts in Set Theory
Subset

Union

Intersection

disjoint / mutually exclusive


Complement
Difference
Reflection
Translation
Logic Operations Involving Binary Pixels
and Images
The principal logic operations used in image processing
are: AND, OR, NOT (COMPLEMENT).
These operations are functionally complete.
Logic operations are preformed on a pixel by pixel basis
between corresponding pixels (bitwise).
Other important logic operations :
XOR (exclusive OR), NAND (NOT-AND)
Logic operations are just a private case for a binary set
operations, such : AND – Intersection , OR – Union,
NOT-Complement.
Structuring element (SE)
 small set to probe the image under study
 for each SE, define origin
 shape and size must be adapted to geometric
properties for the objects

10
How to describe SE
many different ways!
information needed:
position of origo for SE
positions of elements belonging to SE

11
Basic idea
in parallel for each pixel in binary image:
check if SE is ”satisfied”
output pixel is set to 0 or 1 depending on used operation

12
Basic morphological operations
Erosion

Dilation

keep general shape but


combine to smooth with respect to
Opening object
Closening background

13
Erosion
Erosion is used for shrinking of element A by using
element B
Erosion for Sets A and B in Z2, is defined by the
following equation:

 This equation indicates that the erosion of A by B is


the set of all points z such that B, translated by z, is
contained in A.
Erosion – Example 1
Erosion – Example 2
Dilation
Does the structuring element hit the set?
dilation of a set A by structuring element B: all z in A
such that B hits A when origin of B=z

grow the object

A  B  {z|( Bˆ )z  A  Φ}

17
Dilation
 Dilation is used for expanding an element A by using structuring
element B
 Dilation of A by B and is defined by the following equation:

 This equation is based 0n obtaining the reflection 0f B


about its origin and shifting this reflection by z.
 The dilation of A by B is the set of all displacements z,
such that and A overlap by at least one element. Based
On this interpretation the equation of (9.2-1) can be
rewritten as:
Dilation – Example 1
Dilation – Example 2
Dilation – A More interesting Example
Duality between dilation and erosion
Dilation and erosion are duals of each other with
respect to set complementation and reflection. That is,

One of the simplest uses of erosion is for eliminating


irrelevant details (in terms of size) from a binary
image.
Erosion and Dilation summary
useful
erosion
removal of structures of certain shape and size, given by
SE
Dilation
filling of holes of certain shape and size, given by SE

25
Combining erosion and dilation
WANTED:
remove structures / fill holes
without affecting remaining parts

SOLUTION:
combine erosion and dilation
(using same SE)

26
Erosion : eliminating irrelevant detail

structuring element B = 13x13 pixels of gray level 1


27
Opening
erosion followed by dilation, denoted ∘

A  B  ( A  B)  B
eliminates protrusions
breaks necks
smoothes contour

28
Opening

29
Opening

30
Opening

A  B  ( A  B)  B
A  B  {( B) z | ( B) z  A} 31
Closing
dilation followed by erosion, denoted •

A  B  ( A  B)  B
smooth contour
fuse narrow breaks and long thin gulfs
eliminate small holes
fill gaps in the contour

32
Closing

33
Closing

34
Closing

A  B  ( A  B)  B
35
Properties
Opening
(i) AB is a subset (subimage) of A
(ii) If C is a subset of D, then C B is a subset of D B
(iii) (A B) B = A B
Closing
(i) A is a subset (subimage) of AB
(ii) If C is a subset of D, then C B is a subset of D B
(iii) (A B) B = A B

Note: repeated openings/closings has no effect!


36
Duality
Opening and closing are dual with respect to
complementation and reflection

c ˆ
( A  B)  ( A  B) c

37
38
39
Useful: open & close

40
Application: filtering

41
Hit-or-Miss Transformation ⊛ (HMT)
find location of one shape among a set of shapes
”template matching

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


(B2)
does B1 fits the object while, simultaneously, B2
misses the object, i.e., fits the background?
42
Hit-or-Miss Transformation

A  B  ( A  X )  [ A  (W  X )]
c

43
Boundary Extraction

 ( A)  A  ( A  B)
44
Example

45
Region Filling
X k  ( X k 1  B )  A c
k  1,2,3,...

46
Example

47
Thinning

A  B  A  ( A  B)
 A  ( A  B) c

48
Thickening
A  B  A  ( A  B)

49
K
S ( A)   S k ( A)
Skeletons k 0

S k ( A)  ( A  kB)  ( A  kB )  B

K  max{k | ( A  kB)  }

K
A   ( S k ( A)  kB)
k 0

50
51
H = 3x3 structuring element of 1’s X 1  A  {B}
8

Pruning X 2  ( X1  B )
k
k 1

X3  (X2  H )  A
X 4  X1  X 3

52
53
54
55
56
5 basic structuring elements

57
Image Reconstruction and
Restoration
Preview
 Goal of image restoration
 Improve an image in some predefined sense
 Difference with image enhancement ?
 Features
 Image restoration v.s image enhancement
 Objective process v.s. subjective process
• A prior knowledge v.s heuristic process
 A prior knowledge of the degradation
phenomenon is considered
 Modeling the degradation and apply the
inverse process to recover the original
image
Preview (cont.)
 Target
 Degraded digital image
 Sensor, digitizer, display degradations are
less considered
 Spatial domain approach
 Frequency domain approach
Outline

A model of the image degradation /



restoration process


Noise models
Restoration in the presence of noise only – spatial

filtering
Periodic noise reduction by frequency domain

filtering

 Linear, position-invariant degradations Estimating

the degradation function Inverse filtering
degradation/restoration
proces
s

g(x,y)=f(x,y)*h(x,y)
+ (x,y)
G(u,v)=F(u,v)H(u,v)+N(u,v)
Noise models
 Source of noise
 Image acquisition (digitization)
 Image transmission
 Spatial properties of noise
 Statistical behavior of the gray-level values
of pixels
 Noise parameters, correlation with the
image
 Frequency properties of noise
 Fourier spectrum
 Ex. white noise (a constant Fourier
spectrum)
Noise probability density
functions
 Noises are taken as random variables
 Random variables
 Probability density function (PDF)
PDFs of some important
noise models
Test for noise behavior
 Test Pattern

Its histogram:

0 55
Periodic noise
 Arise from electrical or
electromechanical interference during
image acquisition
 Spatial dependence
 Observed in the frequency domain
Estimation of noise
parameters
 Periodic noise
 Observe the frequency spectrum
 Random noise with unknown
PDFs
 Case1:imagingsystem

is available
Capture images of “fl at” environment
 Case2:noisyimagesavailable

Take a strip from constant area

Draw the histogram and obser ve it

Measure the mean and variance
Observe the histogram
Outline

A model of the image degradation / restoration



process


Noise models
Restoration in the presence of noise only – spatial filtering

Periodic noise reduction by frequency domain
filtering

Linear, position-invariant degradations Estimating the

degradation function Inverse filtering

Additive noise only

g(x,y)=f(x,y)
+ (x,y)
G(u,v)=F(u,v)+N(u,v)
Spatial filters for de-
noising additive noise
 Skills similar to image enhancement
 Mean filters
 Order-statistics filters
 Adaptive filters
Mean filters
• Arithmetic mean

Geometric Mean
Filter

Harmonic Mean Filter

Contraharmonic Mean
Filte
ORDER-STATISTIC FILTERS
Median Filter:

Max and Min Filters:

Midpoint Filter:
Alpha-Trimmed Mean Filter:
The white bars in the test
pattern shown are 7 pixels
wide and 210 pixels high. The
separation between bars is 17
pixels. What would this
image look like after
application of (a) A 3 3 ×
arithmetic mean filter? (b) A
7 7 × arithmetic mean filter?
(c) A 9 9 × arithmetic mean
filter?
Adaptive filters

 A d a pt e d t o h
t b e h a v o
i r b as e
st ic a l c h a r ac teri s ti c s o ft h e i m
d o n h
t e s a
t it
ag e in s id e th
efi lteregionS x y
 I m p rovedperformancev.sincreasedcompl
e xi ty

 E x ample:Adaptivelocalnoisereductionfilt
reduction filter
 Adaptive local noise
Simpleststatisticalmeasurement
 Meanandvariance
 KnownparametersonlocalregionS xy
 g(x,y):noisyimagepixelvalue

   : noise variance (as ume known a prior)
 mL :localmean

 L : local variance
reduction filter (cont.)
Adaptive
 local
Analysis: we noise
want to do
 If    is zero, return g(x,y)
 If   >   , return value
L 

close to g(x,y)
 If   =   , return the
L 

arithmetic mean mL

 f^ ( x,y ) =g( x,y σ g( x,y )
Formula [ L
)− σ L2 −m
]
Gaussian
Arith.
oise
  0 mean
  7x7
1000

Geometric
mean
x7
adaptive
Adaptive Median Filter
Outline

A model of the image degradation /



restoration process


Noise models
Restoration in the presence of noise only – spatial

filtering
Periodic noise reduction by frequency domain

filtering

 Linear, position-invariant degradations Estimating

the degradation function Inverse filtering
Periodic noise reduction
 Pure sine wave
 Appear as a pair of impulse
(conjugate) n
i the frequency domain

f ( x,y ) =A sin ( u0 x+v0 y )


F
( u,v )=−
A
2[δ
( u−
u0
2v π
,v
)

v0

)−δ ( u+
u0

,v+
2
0

π
]
j
Periodic noise reduction
(cont.)
 Bandrejectfilters
 Bandpassfilters
 Notchfi lters
 Optimum notchfiltering
Bandreject filte
rs
*Rejectanisotropicfrequency

ideal Butterworth Gaussian


noisy spectrum
filtered

bandreject
Bandpassfilte
rs
 Hbp(u,v)=1-Hbr(u,v)

ℑ {G(u,v )H
−1

(u,v )}
bp
Notch filters
 Reject(or pass) frequencies in
predefined neighborhoods about a
center frequency
ideal

Butterworth Gaussian
Horizontal
Scan lines

Notch
DFT pas

Notch Notch
Outline

A model of the image degradation /



restoration process


Noise models
Restoration in the presence of noise only – spatial

filtering
Periodic noise reduction by frequency domain

filtering

 Linear, position-invariant degradations Estimating

the degradation function Inverse filtering

You might also like