SlideShare a Scribd company logo
1 of 80
EE4H, M.Sc 0407191
Computer Vision
Dr. Mike Spann
m.spann@bham.ac.uk
http://www.eee.bham.ac.uk/spannm
1
Introduction to image
segmentation
 The purpose of image segmentation is to partition an
image into meaningful regions with respect to a
particular application
 The segmentation is based on measurements taken
from the image and might be greylevel, colour, texture,
depth or motion
2
Introduction to image
segmentation
 Usually image segmentation is an initial and vital
step in a series of processes aimed at overall image
understanding
 Applications of image segmentation include
 Identifying objects in a scene for object-based
measurements such as size and shape
 Identifying objects in a moving scene for object-based
video compression (MPEG4)
 Identifying objects which are at different distances from
a sensor using depth measurements from a laser range
finder enabling path planning for a mobile robots
 Intro Video
3
Introduction to image
segmentation
 Example 1
 Segmentation based on greyscale
 Very simple ‘model’ of greyscale leads to inaccuracies in
object labelling
4
Introduction to image
segmentation
 Example 2
 Segmentation based on texture
 Enables object surfaces with varying patterns of grey
to be segmented
5
Introduction to image
segmentation
6
Introduction to image
segmentation
 Example 3
 Segmentation based on motion
 The main difficulty of motion segmentation is that an
intermediate step is required to (either implicitly or
explicitly) estimate an optical flow field
 The segmentation must be based on this estimate and
not, in general, the true flow
7
Introduction to image
segmentation
8
Introduction to image
segmentation
 Example 3
 Segmentation based on depth
 This example shows a range image, obtained with a laser
range finder
 A segmentation based on the range (the object distance
from the sensor) is useful in guiding mobile robots
9
Introduction to image
segmentation
10
Original
image
Range
image
Segmented
image
Greylevel histogram-based
segmentation
 We will look at two very simple image
segmentation techniques that are based on the
greylevel histogram of an image
 Thresholding
 Clustering
 We will use a very simple object-background test
image
 We will consider a zero, low and high noise image
11
Greylevel histogram-based
segmentation
12
Noise free Low noise High noise
Greylevel histogram-based
segmentation
 How do we characterise low noise and high
noise?
 We can consider the histograms of our images
 For the noise free image, its simply two spikes at
i=100, i=150
 For the low noise image, there are two clear peaks
centred on i=100, i=150
 For the high noise image, there is a single peak – two
greylevel populations corresponding to object and
background have merged
13
Greylevel histogram-based
segmentation
14
0.00
500.00
1000.00
1500.00
2000.00
2500.00
0.00 50.00 100.00 150.00 200.00 250.00
i
h(i)
Noise free
Low noise
High noise
Greylevel histogram-based
segmentation
 We can define the input image signal-to-noise ratio in
terms of the mean greylevel value of the object pixels
and background pixels and the additive noise standard
deviation
15
S N b o
/ 

 

Greylevel histogram-based
segmentation
 For our test images :
 S/N (noise free) = 
 S/N (low noise) = 5
 S/N (high noise) = 2
16
Greylevel thresholding
 We can easily understand segmentation based on
thresholding by looking at the histogram of the low
noise object/background image
 There is a clear ‘valley’ between to two peaks
17
Greylevel thresholding
18
0.00
500.00
1000.00
1500.00
2000.00
2500.00
0.00 50.00 100.00 150.00 200.00 250.00
i
h(i)
Background
Object
T
Greylevel thresholding
 We can define the greylevel thresholding algorithm as
follows:
 If the greylevel of pixel p <=T then pixel p is an object
pixel
else
 Pixel p is a background pixel
19
Greylevel thresholding
 This simple threshold test begs the obvious question
how do we determine the threshold ?
 Many approaches possible
 Interactive threshold
 Adaptive threshold
 Minimisation method
20
Greylevel thresholding
 We will consider in detail a minimisation method for
determining the threshold
 Minimisation of the within group variance
 Robot Vision, Haralick & Shapiro, volume 1, page 20
21
Greylevel thresholding
 Idealized object/background image histogram
22
0.00
500.00
1000.00
1500.00
2000.00
2500.00
0.00 50.00 100.00 150.00 200.00 250.00
i
h(i)
T
Greylevel thresholding
 Any threshold separates the histogram into 2
groups with each group having its own statistics
(mean, variance)
 The homogeneity of each group is measured by
the within group variance
 The optimum threshold is that threshold which
minimizes the within group variance thus
maximizing the homogeneity of each group
23
Greylevel thresholding
 Let group o (object) be those pixels with greylevel <=T
 Let group b (background) be those pixels with
greylevel >T
 The prior probability of group o is po(T)
 The prior probability of group b is pb(T)
24
Greylevel thresholding
 The following expressions can easily be derived for
prior probabilities of object and background
 where h(i) is the histogram of an N pixel image
25
p T P i
o
i
T
( ) ( )
 
0
p T P i
b
i T
( ) ( )
 
 1
255
P(i h i N
) ( ) /

Greylevel thresholding
 The mean and variance of each group are as follows :
26
o
i
T
o
T iP(i p T
( ) ) / ( )
 
0
b
i T
b
T iP i p T
( ) ( ) / ( )
 
 1
255
 
 
o o
i
T
o
T i T P(i p T
2 2
0
( ) ( ) )/ ( )
 


 
 
b b
i T
b
T i T P i p T
2 2
1
255
( ) ( ) ( )/ ( )
 

 
Greylevel thresholding
 The within group variance is defined as :
 We determine the optimum T by minimizing this
expression with respect to T
 Only requires 256 comparisons for and 8-bit greylevel
image
27
  
W o o b b
T T p T T p T
2 2 2
( ) ( ) ( ) ( ) ( )
 
Greylevel thresholding
28
0.00
500.00
1000.00
1500.00
2000.00
2500.00
0.00 50.00 100.00 150.00 200.00 250.00
i
h(i)
Histogram
Within group variance
Topt
Greylevel thresholding
 We can examine the performance of this algorithm on
our low and high noise image
 For the low noise case, it gives an optimum threshold of
T=124
 Almost exactly halfway between the object and
background peaks
 We can apply this optimum threshold to both the low
and high noise images
29
Greylevel thresholding
30
Low noise image Thresholded at T=124
Greylevel thresholding
31
Low noise image Thresholded at T=124
Greylevel thresholding
 High level of pixel miss-classification noticeable
 This is typical performance for thresholding
 The extent of pixel miss-classification is determined by
the overlap between object and background histograms.
32
Greylevel thresholding
33
0.00
0.01
0.02
x
p(x)
o b
T
Object
Background
Greylevel thresholding
34
0.00
0.01
0.02
x
p(x)
o
Object
Background
b
T
Greylevel thresholding
 Easy to see that, in both cases, for any value of the
threshold, object pixels will be miss-classified as
background and vice versa
 For greater histogram overlap, the pixel miss-
classification is obviously greater
 We could even quantify the probability of error in
terms of the mean and standard deviations of the
object and background histograms
35
Greylevel clustering
 Consider an idealized object/background
histogram
36
Background
Object
c1 c2
Greylevel clustering
 Clustering tries to separate the histogram into 2
groups
 Defined by two cluster centres c1 and c2
 Greylevels classified according to the nearest cluster
centre
37
Greylevel clustering
 A nearest neighbour clustering algorithm allows us
perform a greylevel segmentation using clustering
 A simple case of a more general and widely used K-
means clustering
 A simple iterative algorithm which has known
convergence properties
38
Greylevel clustering
 Given a set of greylevels
 We can partition this set into two groups
39
 
g g g N
( ), ( )...... ( )
1 2
 
g g g N
1 1 1 1
1 2
( ), ( )...... ( )
 
g g g N
2 2 2 2
1 2
( ), ( )...... ( )
Greylevel clustering
 Compute the local means of each group
40
c
N
g i
i
N
1
1
1
1
1 1
 

( )



2
1
2
2
2 )
(
1 N
i
i
g
N
c
Greylevel clustering
 Re-define the new groupings
 In other words all grey levels in set 1 are nearer to
cluster centre c1 and all grey levels in set 2 are
nearer to cluster centre c2
41
g k c g k c k N
1 1 1 2 1
1
( ) ( ) ..
   
g k c g k c k N
2 2 2 1 2
1
( ) ( ) ..
   
Greylevel clustering
 But, we have a chicken and egg situation
 The problem with the above definition is that each
group mean is defined in terms of the partitions and
vice versa
 The solution is to define an iterative algorithm and
worry about the convergence of the algorithm later
42
Greylevel clustering
 The iterative algorithm is as follows
43
Initialize the label of each pixel randomly
Repeat
c1= mean of pixels assigned to object label
c2= mean of pixels assigned to background label
Compute partition
Compute partition
Until none pixel labelling changes
 
g g g N
1 1 1 1
1 2
( ), ( )...... ( )
 
g g g N
2 2 2 2
1 2
( ), ( )...... ( )
Greylevel clustering
 Two questions to answer
 Does this algorithm converge?
 If so, to what does it converge?
 We can show that the algorithm is guaranteed to
converge and also that it converges to a sensible result
44
Greylevel clustering
 Outline proof of algorithm convergence
 Define a ‘cost function’ at iteration r
 E(r)
>0
45
   
E
N
g i c
N
g i c
r r r
i
N
r r
i
N
( ) ( ) ( ) ( ) ( )
( ) ( )
  
 





1 1
1
1 1
1 2
1 2
2 2
1 2
1
1 2
Greylevel clustering
 Now update the cluster centres
 Finally update the cost function
46
c
N
g i
r r
i
N
1
1
1
1
1 1
( ) ( )
( )
 

   
E
N
g i c
N
g i c
r r r
i
N
r r
i
N
1
1
1 1
2
1 2
2 2
2
1
1 1
1 2
( ) ( ) ( ) ( ) ( )
( ) ( )
  
 

 



1
1
)
(
2
2
)
(
2 )
(
1 N
i
r
r
i
g
N
c
Greylevel clustering
 Easy to show that
 Since E(r)
>0, we conclude that the algorithm must
converge
 but
 What does the algorithm converge to?
47
E E E
r r r
( ) ( ) ( )

 
1
1
Greylevel clustering
 E1 is simply the sum of the variances within each
cluster which is minimised at convergence
 Gives sensible results for well separated clusters
 Similar performance to thresholding
48
Greylevel clustering
49
c1 c2
g1
g2
Relaxation labelling
 All of the segmentation algorithms we have
considered thus far have been based on the histogram
of the image
 This ignores the greylevels of each pixels’ neighbours
which will strongly influence the classification of each
pixel
 Objects are usually represented by a spatially contiguous
set of pixels
50
Relaxation labelling
 The following is a trivial example of a likely pixel miss-
classification
51
Object
Background
Relaxation labelling
 Relaxation labelling is a fairly general technique in
computer vision which is able to incorporate
constraints (such as spatial continuity) into image
labelling problems
 We will look at a simple application to greylevel
image segmentation
 It could be extended to colour/texture/motion
segmentation
52
Relaxation labelling
 Assume a simple object/background image
 p(i) is the probability that pixel i is a background pixel
 (1- p(i)) is the probability that pixel i is a object pixel
53
Relaxation labelling
 Define the 8-neighbourhood of pixel i as {i1,i2,….i8}
54
i
i1 i2 i3
i4
i5
i6 i7 i8
Relaxation labelling
 Define consistencies cs and cd
 Positive cs and negative cd encourages neighbouring
pixels to have the same label
 Setting these consistencies to appropriate values will
encourage spatially contiguous object and background
regions
55
Relaxation labelling
 We assume again a bi-modal object/background
histogram with maximum greylevel gmax
56
Background
Object
0 gmax
Relaxation labelling
 We can initialize the probabilities
 Our relaxation algorithm must ‘drive’ the background
pixel probabilities p(i) to 1 and the object pixel
probabilities to 0
57
p i g i g
( )
max
( ) ( ) /
0

Relaxation labelling
 We want to take into account:
 Neighbouring probabilities p(i1), p(i2), …… p(i8)
 The consistency values cs and cd
 We would like our algorithm to ‘saturate’ such that
p(i)~1
 We can then convert the probabilities to labels by
multiplying by 255
58
Relaxation labelling
 We can derive the equation for relaxation labelling by
first considering a neighbour i1 of pixel i
 We would like to evaluate the contribution to the
increment in p(i) from i1
 Let this increment be q(i1)
 We can evaluate q(i1) by taking into account the consistencies
59
Relaxation labelling
 We can apply a simple decision rule to determine the
contribution to the increment q(i1) from pixel i1
 If p(ii) >0.5 the contribution from pixel i1 increments
p(i)
 If p(ii) <0.5 the contribution from pixel i1 decrements
p(i)
60
Relaxation labelling
 Since cs >0 and cd <0 its easy to see that the following
expression for q(i1) has the right properties
 We can now average all the contributions from the 8-
neighbours of i to get the total increment to p(i)
61
q i c p i c p i
s d
( ) ( ) ( ( ))
1 1 1
1
  
)
))
(
1
(
)
(
(
8
1
)
(
8
1






h
h
d
h
s i
p
c
i
p
c
i
p
Relaxation labelling
 Easy to check that –1<p(i)<1 for -1< cs ,cd <1
 Can update p(i) as follows
 Ensures that p(i) remains positive
 Basic form of the relaxation equation
62
p i p i p i
r r
( ) ( )
( ) ~ ( )( ( ))


1
1 
Relaxation labelling
 We need to normalize the probabilities p(i) as they
must stay in the range {0..1}
 After every iteration p(r)
(i) is rescaled to bring it back
into the correct range
 Remember our requirement that likely background
pixel probabilities are ‘driven’ to 1
63
Relaxation labelling
 One possible approach is to use a constant
normalisation factor
 In the following example, the central background pixel
probability may get stuck at 0.9 if max(p(i))=1
64
p i p i p i
r r
i
r
( ) ( ) ( )
( ) ( ) / max ( )

0.9 0.9 0.9
0.9 0.9
0.9 0.9 0.9
0.9
Relaxation labelling
 The following normalisation equation has all the right
properties
 It can be derived from the general theory of relaxation
labelling
 Its easy to check that 0<p(r)
(i)<1
65
p i
p i p i
p i p i p i p i
r
r
r r
( )
( )
( ) ( )
( )
( )( ( ))
( )( ( )) ( ( ))( ( ))


   

 
1
1 1
1
1 1 1

 
Relaxation labelling
 We can check to see if this normalisation equation has
the correct ‘saturation’ properties
 When p(r-1)
(i)=1, p(r)
(i)=1
 When p(r-1)
(i)=0, p(r)
(i)=0
 When p(r-1)
(i)=0.9 and p(i)=0.9, p(r)
(i)=0.994
 When p(r-1)
(i)=0.1 and p(i)=-0.9, p(r)
(i)=0.012
 We can see that p(i) converges to 0 or 1
66
Relaxation labelling
 Algorithm performance on the high noise image
 Comparison with thresholding
67
High noise circle image ’ Optimum’ threshold
Relaxation labeling - 20
iterations
Relaxation labelling
 The following is an example of a case where the
algorithm has problems due to the thin structure in
the clamp image
68
clamp image
original
clamp image
noise added
segmented clamp
image 10 iterations
Relaxation labelling
 Applying the algorithm to normal greylevel images we
can see a clear separation into light and dark areas
69
Original 2 iterations 5 iterations 10 iterations
Relaxation labelling
 The histogram of each image shows the clear
saturation to 0 and 255
70
0.00
1000.00
2000.00
3000.00
4000.00
5000.00
0.00 50.00 100.00 150.00 200.00 250.00
i
h(i)
Original
2 iterations
5 iterations
10 iterations
 In relaxation labelling we have seen that we are
representing the probability that a pixel has a certain
label
 In general we may imagine that an image comprises L
segments (labels)
 Within segment l the pixels (feature vectors) have a
probability distribution represented by
 represents the parameters of the data in segment l
 Mean and variance of the greylevels
 Mean vector and covariance matrix of the colours
 Texture parameters
71
The Expectation/Maximization (EM)
algorithm
)
|
( l
l x
p 
l

The Expectation/Maximization
(EM) algorithm
72
1

2

3

4

5

The Expectation/Maximization
(EM) algorithm
 Once again a chicken and egg problem arises
 If we knew then we could obtain a labelling
for each by simply choosing that label which
maximizes
 If we new the label for each we could obtain
by using a simple maximum likelihood estimator
 The EM algorithm is designed to deal with this type of
problem but it frames it slightly differently
 It regards segmentation as a missing (or incomplete)
data estimation problem
73
L
l
l ..
1
: 

)
|
( l
l x
p 
x
L
l
l ..
1
: 

x
The Expectation/Maximization
(EM) algorithm
 The incomplete data are just the measured pixel
greylevels or feature vectors
 We can define a probability distribution of the
incomplete data as
 The complete data are the measured greylevels or
feature vectors plus a mapping function which
indicates the labelling of each pixel
 Given the complete data (pixels plus labels) we can
easily work out estimates of the parameters
 But from the incomplete data no closed form solution
exists
)
.....
,
;
( 2
1 L
i x
p 


(.)
f
L
l
l ..
1
: 

The Expectation/Maximization
(EM) algorithm
 Once again we resort to an iterative strategy and hope
that we get convergence
 The algorithm is as follows:
75
Initialize an estimate of
Repeat
Step 1: (E step)
Obtain an estimate of the labels based on
the current parameter estimates
Step 2: (M step)
Update the parameter estimates based on the
current labelling
Until Convergence
L
l
l ..
1
: 

The Expectation/Maximization
(EM) algorithm
 A recent approach to applying EM to image
segmentation is to assume the image pixels or feature
vectors follow a mixture model
 Generally we assume that each component of the
mixture model is a Gaussian
 A Gaussian mixture model (GMM)
76



L
l l
l
l x
p
x
p 1
)
|
(
)
|
( 

))
(
)
(
2
1
exp(
)
det(
)
2
(
1
)
|
( 1
2
/
1
2
/ l
l
T
l
l
d
l
l x
x
x
p 


 




 
1
1


L
l l

The Expectation/Maximization
(EM) algorithm
 Our parameter space for our distribution now includes
the mean vectors and covariance matrices for each
component in the mixture plus the mixing weights
 We choose a Gaussian for each component because the
ML estimate of each parameter in the E-step becomes
linear
77
 
L
L
L 


 ,
,
.
,.........
,
, 1
1
1 



The Expectation/Maximization
(EM) algorithm
 Define a posterior probability as the
probability that pixel j belongs to region l given the
value of the feature vector
 Using Bayes rule we can write the following equation
 This actually is the E-step of our EM algorithm as
allows us to assign probabilities to each label at each
pixel
78
)
,
|
( l
j
x
l
P 
j
x
 
 L
k k
k
k
l
j
l
l
l
j
x
p
x
p
x
l
P
1
)
|
(
)
|
(
)
,
|
(





The Expectation/Maximization
(EM) algorithm
 The M step simply updates the parameter estimates
using MLL estimation
79




n
j
m
l
j
m
l x
l
P
n 1
)
(
)
1
(
)
,
|
(
1







 n
j
m
l
j
n
j
m
l
j
j
m
l
x
l
P
x
l
P
x
1
)
(
1
)
(
)
1
(
)
,
|
(
)
,
|
(



 








 n
j
m
l
j
n
j
T
m
l
j
m
l
j
m
l
j
m
l
x
l
P
x
x
x
l
P
1
)
(
1
)
(
)
(
)
(
)
1
(
)
,
|
(
)
)(
(
)
,
|
(




Conclusion
 We have seen several examples of greylevel and colour
segmentation methods
 Thresholding
 Clustering
 Relaxation labelling
 EM algorithm
 Clustering, relaxation labelling and the EM algorithm
are general techniques in computer vision with many
applications
80

More Related Content

Similar to Image Segmentation.ppt

08 cie552 image_segmentation
08 cie552 image_segmentation08 cie552 image_segmentation
08 cie552 image_segmentationElsayed Hemayed
 
Bucket sort- A Noncomparision Algorithm
Bucket sort- A Noncomparision AlgorithmBucket sort- A Noncomparision Algorithm
Bucket sort- A Noncomparision AlgorithmKrupali Mistry
 
Lect 03 - first portion
Lect 03 - first portionLect 03 - first portion
Lect 03 - first portionMoe Moe Myint
 
00463517b1e90c1e63000000
00463517b1e90c1e6300000000463517b1e90c1e63000000
00463517b1e90c1e63000000Ivonne Liu
 
Image processing
Image processingImage processing
Image processingabuamo
 
Histogram based Enhancement
Histogram based Enhancement Histogram based Enhancement
Histogram based Enhancement Vivek V
 
Histogram based enhancement
Histogram based enhancementHistogram based enhancement
Histogram based enhancementliba manopriya.J
 
3 ijaems nov-2015-6-development of an advanced technique for historical docum...
3 ijaems nov-2015-6-development of an advanced technique for historical docum...3 ijaems nov-2015-6-development of an advanced technique for historical docum...
3 ijaems nov-2015-6-development of an advanced technique for historical docum...INFOGAIN PUBLICATION
 
A Framework of Secured and Bio-Inspired Image Steganography Using Chaotic Enc...
A Framework of Secured and Bio-Inspired Image Steganography Using Chaotic Enc...A Framework of Secured and Bio-Inspired Image Steganography Using Chaotic Enc...
A Framework of Secured and Bio-Inspired Image Steganography Using Chaotic Enc...Varun Ojha
 
Labview with dwt for denoising the blurred biometric images
Labview with dwt for denoising the blurred biometric imagesLabview with dwt for denoising the blurred biometric images
Labview with dwt for denoising the blurred biometric imagesijcsa
 
Chapter10_Segmentation.ppt
Chapter10_Segmentation.pptChapter10_Segmentation.ppt
Chapter10_Segmentation.pptMrsSDivyaBME
 
Chapter 1 introduction (Image Processing)
Chapter 1 introduction (Image Processing)Chapter 1 introduction (Image Processing)
Chapter 1 introduction (Image Processing)Varun Ojha
 
Digital image processing - Image Enhancement (MATERIAL)
Digital image processing  - Image Enhancement (MATERIAL)Digital image processing  - Image Enhancement (MATERIAL)
Digital image processing - Image Enhancement (MATERIAL)Mathankumar S
 
Digital Image Processing - Image Enhancement
Digital Image Processing  - Image EnhancementDigital Image Processing  - Image Enhancement
Digital Image Processing - Image EnhancementMathankumar S
 

Similar to Image Segmentation.ppt (20)

08 cie552 image_segmentation
08 cie552 image_segmentation08 cie552 image_segmentation
08 cie552 image_segmentation
 
Bucket sort- A Noncomparision Algorithm
Bucket sort- A Noncomparision AlgorithmBucket sort- A Noncomparision Algorithm
Bucket sort- A Noncomparision Algorithm
 
Final Review
Final ReviewFinal Review
Final Review
 
Lect 03 - first portion
Lect 03 - first portionLect 03 - first portion
Lect 03 - first portion
 
Dip3
Dip3Dip3
Dip3
 
00463517b1e90c1e63000000
00463517b1e90c1e6300000000463517b1e90c1e63000000
00463517b1e90c1e63000000
 
Image processing
Image processingImage processing
Image processing
 
h.pdf
h.pdfh.pdf
h.pdf
 
Histogram based Enhancement
Histogram based Enhancement Histogram based Enhancement
Histogram based Enhancement
 
Histogram based enhancement
Histogram based enhancementHistogram based enhancement
Histogram based enhancement
 
IR.pptx
IR.pptxIR.pptx
IR.pptx
 
3 ijaems nov-2015-6-development of an advanced technique for historical docum...
3 ijaems nov-2015-6-development of an advanced technique for historical docum...3 ijaems nov-2015-6-development of an advanced technique for historical docum...
3 ijaems nov-2015-6-development of an advanced technique for historical docum...
 
regions
regionsregions
regions
 
A Framework of Secured and Bio-Inspired Image Steganography Using Chaotic Enc...
A Framework of Secured and Bio-Inspired Image Steganography Using Chaotic Enc...A Framework of Secured and Bio-Inspired Image Steganography Using Chaotic Enc...
A Framework of Secured and Bio-Inspired Image Steganography Using Chaotic Enc...
 
Digital.cc
Digital.ccDigital.cc
Digital.cc
 
Labview with dwt for denoising the blurred biometric images
Labview with dwt for denoising the blurred biometric imagesLabview with dwt for denoising the blurred biometric images
Labview with dwt for denoising the blurred biometric images
 
Chapter10_Segmentation.ppt
Chapter10_Segmentation.pptChapter10_Segmentation.ppt
Chapter10_Segmentation.ppt
 
Chapter 1 introduction (Image Processing)
Chapter 1 introduction (Image Processing)Chapter 1 introduction (Image Processing)
Chapter 1 introduction (Image Processing)
 
Digital image processing - Image Enhancement (MATERIAL)
Digital image processing  - Image Enhancement (MATERIAL)Digital image processing  - Image Enhancement (MATERIAL)
Digital image processing - Image Enhancement (MATERIAL)
 
Digital Image Processing - Image Enhancement
Digital Image Processing  - Image EnhancementDigital Image Processing  - Image Enhancement
Digital Image Processing - Image Enhancement
 

Recently uploaded

IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZTE
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 

Recently uploaded (20)

IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 

Image Segmentation.ppt

  • 1. EE4H, M.Sc 0407191 Computer Vision Dr. Mike Spann m.spann@bham.ac.uk http://www.eee.bham.ac.uk/spannm 1
  • 2. Introduction to image segmentation  The purpose of image segmentation is to partition an image into meaningful regions with respect to a particular application  The segmentation is based on measurements taken from the image and might be greylevel, colour, texture, depth or motion 2
  • 3. Introduction to image segmentation  Usually image segmentation is an initial and vital step in a series of processes aimed at overall image understanding  Applications of image segmentation include  Identifying objects in a scene for object-based measurements such as size and shape  Identifying objects in a moving scene for object-based video compression (MPEG4)  Identifying objects which are at different distances from a sensor using depth measurements from a laser range finder enabling path planning for a mobile robots  Intro Video 3
  • 4. Introduction to image segmentation  Example 1  Segmentation based on greyscale  Very simple ‘model’ of greyscale leads to inaccuracies in object labelling 4
  • 5. Introduction to image segmentation  Example 2  Segmentation based on texture  Enables object surfaces with varying patterns of grey to be segmented 5
  • 7. Introduction to image segmentation  Example 3  Segmentation based on motion  The main difficulty of motion segmentation is that an intermediate step is required to (either implicitly or explicitly) estimate an optical flow field  The segmentation must be based on this estimate and not, in general, the true flow 7
  • 9. Introduction to image segmentation  Example 3  Segmentation based on depth  This example shows a range image, obtained with a laser range finder  A segmentation based on the range (the object distance from the sensor) is useful in guiding mobile robots 9
  • 11. Greylevel histogram-based segmentation  We will look at two very simple image segmentation techniques that are based on the greylevel histogram of an image  Thresholding  Clustering  We will use a very simple object-background test image  We will consider a zero, low and high noise image 11
  • 13. Greylevel histogram-based segmentation  How do we characterise low noise and high noise?  We can consider the histograms of our images  For the noise free image, its simply two spikes at i=100, i=150  For the low noise image, there are two clear peaks centred on i=100, i=150  For the high noise image, there is a single peak – two greylevel populations corresponding to object and background have merged 13
  • 14. Greylevel histogram-based segmentation 14 0.00 500.00 1000.00 1500.00 2000.00 2500.00 0.00 50.00 100.00 150.00 200.00 250.00 i h(i) Noise free Low noise High noise
  • 15. Greylevel histogram-based segmentation  We can define the input image signal-to-noise ratio in terms of the mean greylevel value of the object pixels and background pixels and the additive noise standard deviation 15 S N b o /     
  • 16. Greylevel histogram-based segmentation  For our test images :  S/N (noise free) =   S/N (low noise) = 5  S/N (high noise) = 2 16
  • 17. Greylevel thresholding  We can easily understand segmentation based on thresholding by looking at the histogram of the low noise object/background image  There is a clear ‘valley’ between to two peaks 17
  • 18. Greylevel thresholding 18 0.00 500.00 1000.00 1500.00 2000.00 2500.00 0.00 50.00 100.00 150.00 200.00 250.00 i h(i) Background Object T
  • 19. Greylevel thresholding  We can define the greylevel thresholding algorithm as follows:  If the greylevel of pixel p <=T then pixel p is an object pixel else  Pixel p is a background pixel 19
  • 20. Greylevel thresholding  This simple threshold test begs the obvious question how do we determine the threshold ?  Many approaches possible  Interactive threshold  Adaptive threshold  Minimisation method 20
  • 21. Greylevel thresholding  We will consider in detail a minimisation method for determining the threshold  Minimisation of the within group variance  Robot Vision, Haralick & Shapiro, volume 1, page 20 21
  • 22. Greylevel thresholding  Idealized object/background image histogram 22 0.00 500.00 1000.00 1500.00 2000.00 2500.00 0.00 50.00 100.00 150.00 200.00 250.00 i h(i) T
  • 23. Greylevel thresholding  Any threshold separates the histogram into 2 groups with each group having its own statistics (mean, variance)  The homogeneity of each group is measured by the within group variance  The optimum threshold is that threshold which minimizes the within group variance thus maximizing the homogeneity of each group 23
  • 24. Greylevel thresholding  Let group o (object) be those pixels with greylevel <=T  Let group b (background) be those pixels with greylevel >T  The prior probability of group o is po(T)  The prior probability of group b is pb(T) 24
  • 25. Greylevel thresholding  The following expressions can easily be derived for prior probabilities of object and background  where h(i) is the histogram of an N pixel image 25 p T P i o i T ( ) ( )   0 p T P i b i T ( ) ( )    1 255 P(i h i N ) ( ) / 
  • 26. Greylevel thresholding  The mean and variance of each group are as follows : 26 o i T o T iP(i p T ( ) ) / ( )   0 b i T b T iP i p T ( ) ( ) / ( )    1 255     o o i T o T i T P(i p T 2 2 0 ( ) ( ) )/ ( )         b b i T b T i T P i p T 2 2 1 255 ( ) ( ) ( )/ ( )     
  • 27. Greylevel thresholding  The within group variance is defined as :  We determine the optimum T by minimizing this expression with respect to T  Only requires 256 comparisons for and 8-bit greylevel image 27    W o o b b T T p T T p T 2 2 2 ( ) ( ) ( ) ( ) ( )  
  • 28. Greylevel thresholding 28 0.00 500.00 1000.00 1500.00 2000.00 2500.00 0.00 50.00 100.00 150.00 200.00 250.00 i h(i) Histogram Within group variance Topt
  • 29. Greylevel thresholding  We can examine the performance of this algorithm on our low and high noise image  For the low noise case, it gives an optimum threshold of T=124  Almost exactly halfway between the object and background peaks  We can apply this optimum threshold to both the low and high noise images 29
  • 30. Greylevel thresholding 30 Low noise image Thresholded at T=124
  • 31. Greylevel thresholding 31 Low noise image Thresholded at T=124
  • 32. Greylevel thresholding  High level of pixel miss-classification noticeable  This is typical performance for thresholding  The extent of pixel miss-classification is determined by the overlap between object and background histograms. 32
  • 35. Greylevel thresholding  Easy to see that, in both cases, for any value of the threshold, object pixels will be miss-classified as background and vice versa  For greater histogram overlap, the pixel miss- classification is obviously greater  We could even quantify the probability of error in terms of the mean and standard deviations of the object and background histograms 35
  • 36. Greylevel clustering  Consider an idealized object/background histogram 36 Background Object c1 c2
  • 37. Greylevel clustering  Clustering tries to separate the histogram into 2 groups  Defined by two cluster centres c1 and c2  Greylevels classified according to the nearest cluster centre 37
  • 38. Greylevel clustering  A nearest neighbour clustering algorithm allows us perform a greylevel segmentation using clustering  A simple case of a more general and widely used K- means clustering  A simple iterative algorithm which has known convergence properties 38
  • 39. Greylevel clustering  Given a set of greylevels  We can partition this set into two groups 39   g g g N ( ), ( )...... ( ) 1 2   g g g N 1 1 1 1 1 2 ( ), ( )...... ( )   g g g N 2 2 2 2 1 2 ( ), ( )...... ( )
  • 40. Greylevel clustering  Compute the local means of each group 40 c N g i i N 1 1 1 1 1 1    ( )    2 1 2 2 2 ) ( 1 N i i g N c
  • 41. Greylevel clustering  Re-define the new groupings  In other words all grey levels in set 1 are nearer to cluster centre c1 and all grey levels in set 2 are nearer to cluster centre c2 41 g k c g k c k N 1 1 1 2 1 1 ( ) ( ) ..     g k c g k c k N 2 2 2 1 2 1 ( ) ( ) ..    
  • 42. Greylevel clustering  But, we have a chicken and egg situation  The problem with the above definition is that each group mean is defined in terms of the partitions and vice versa  The solution is to define an iterative algorithm and worry about the convergence of the algorithm later 42
  • 43. Greylevel clustering  The iterative algorithm is as follows 43 Initialize the label of each pixel randomly Repeat c1= mean of pixels assigned to object label c2= mean of pixels assigned to background label Compute partition Compute partition Until none pixel labelling changes   g g g N 1 1 1 1 1 2 ( ), ( )...... ( )   g g g N 2 2 2 2 1 2 ( ), ( )...... ( )
  • 44. Greylevel clustering  Two questions to answer  Does this algorithm converge?  If so, to what does it converge?  We can show that the algorithm is guaranteed to converge and also that it converges to a sensible result 44
  • 45. Greylevel clustering  Outline proof of algorithm convergence  Define a ‘cost function’ at iteration r  E(r) >0 45     E N g i c N g i c r r r i N r r i N ( ) ( ) ( ) ( ) ( ) ( ) ( )           1 1 1 1 1 1 2 1 2 2 2 1 2 1 1 2
  • 46. Greylevel clustering  Now update the cluster centres  Finally update the cost function 46 c N g i r r i N 1 1 1 1 1 1 ( ) ( ) ( )        E N g i c N g i c r r r i N r r i N 1 1 1 1 2 1 2 2 2 2 1 1 1 1 2 ( ) ( ) ( ) ( ) ( ) ( ) ( )            1 1 ) ( 2 2 ) ( 2 ) ( 1 N i r r i g N c
  • 47. Greylevel clustering  Easy to show that  Since E(r) >0, we conclude that the algorithm must converge  but  What does the algorithm converge to? 47 E E E r r r ( ) ( ) ( )    1 1
  • 48. Greylevel clustering  E1 is simply the sum of the variances within each cluster which is minimised at convergence  Gives sensible results for well separated clusters  Similar performance to thresholding 48
  • 50. Relaxation labelling  All of the segmentation algorithms we have considered thus far have been based on the histogram of the image  This ignores the greylevels of each pixels’ neighbours which will strongly influence the classification of each pixel  Objects are usually represented by a spatially contiguous set of pixels 50
  • 51. Relaxation labelling  The following is a trivial example of a likely pixel miss- classification 51 Object Background
  • 52. Relaxation labelling  Relaxation labelling is a fairly general technique in computer vision which is able to incorporate constraints (such as spatial continuity) into image labelling problems  We will look at a simple application to greylevel image segmentation  It could be extended to colour/texture/motion segmentation 52
  • 53. Relaxation labelling  Assume a simple object/background image  p(i) is the probability that pixel i is a background pixel  (1- p(i)) is the probability that pixel i is a object pixel 53
  • 54. Relaxation labelling  Define the 8-neighbourhood of pixel i as {i1,i2,….i8} 54 i i1 i2 i3 i4 i5 i6 i7 i8
  • 55. Relaxation labelling  Define consistencies cs and cd  Positive cs and negative cd encourages neighbouring pixels to have the same label  Setting these consistencies to appropriate values will encourage spatially contiguous object and background regions 55
  • 56. Relaxation labelling  We assume again a bi-modal object/background histogram with maximum greylevel gmax 56 Background Object 0 gmax
  • 57. Relaxation labelling  We can initialize the probabilities  Our relaxation algorithm must ‘drive’ the background pixel probabilities p(i) to 1 and the object pixel probabilities to 0 57 p i g i g ( ) max ( ) ( ) / 0 
  • 58. Relaxation labelling  We want to take into account:  Neighbouring probabilities p(i1), p(i2), …… p(i8)  The consistency values cs and cd  We would like our algorithm to ‘saturate’ such that p(i)~1  We can then convert the probabilities to labels by multiplying by 255 58
  • 59. Relaxation labelling  We can derive the equation for relaxation labelling by first considering a neighbour i1 of pixel i  We would like to evaluate the contribution to the increment in p(i) from i1  Let this increment be q(i1)  We can evaluate q(i1) by taking into account the consistencies 59
  • 60. Relaxation labelling  We can apply a simple decision rule to determine the contribution to the increment q(i1) from pixel i1  If p(ii) >0.5 the contribution from pixel i1 increments p(i)  If p(ii) <0.5 the contribution from pixel i1 decrements p(i) 60
  • 61. Relaxation labelling  Since cs >0 and cd <0 its easy to see that the following expression for q(i1) has the right properties  We can now average all the contributions from the 8- neighbours of i to get the total increment to p(i) 61 q i c p i c p i s d ( ) ( ) ( ( )) 1 1 1 1    ) )) ( 1 ( ) ( ( 8 1 ) ( 8 1       h h d h s i p c i p c i p
  • 62. Relaxation labelling  Easy to check that –1<p(i)<1 for -1< cs ,cd <1  Can update p(i) as follows  Ensures that p(i) remains positive  Basic form of the relaxation equation 62 p i p i p i r r ( ) ( ) ( ) ~ ( )( ( ))   1 1 
  • 63. Relaxation labelling  We need to normalize the probabilities p(i) as they must stay in the range {0..1}  After every iteration p(r) (i) is rescaled to bring it back into the correct range  Remember our requirement that likely background pixel probabilities are ‘driven’ to 1 63
  • 64. Relaxation labelling  One possible approach is to use a constant normalisation factor  In the following example, the central background pixel probability may get stuck at 0.9 if max(p(i))=1 64 p i p i p i r r i r ( ) ( ) ( ) ( ) ( ) / max ( )  0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9
  • 65. Relaxation labelling  The following normalisation equation has all the right properties  It can be derived from the general theory of relaxation labelling  Its easy to check that 0<p(r) (i)<1 65 p i p i p i p i p i p i p i r r r r ( ) ( ) ( ) ( ) ( ) ( )( ( )) ( )( ( )) ( ( ))( ( ))          1 1 1 1 1 1 1   
  • 66. Relaxation labelling  We can check to see if this normalisation equation has the correct ‘saturation’ properties  When p(r-1) (i)=1, p(r) (i)=1  When p(r-1) (i)=0, p(r) (i)=0  When p(r-1) (i)=0.9 and p(i)=0.9, p(r) (i)=0.994  When p(r-1) (i)=0.1 and p(i)=-0.9, p(r) (i)=0.012  We can see that p(i) converges to 0 or 1 66
  • 67. Relaxation labelling  Algorithm performance on the high noise image  Comparison with thresholding 67 High noise circle image ’ Optimum’ threshold Relaxation labeling - 20 iterations
  • 68. Relaxation labelling  The following is an example of a case where the algorithm has problems due to the thin structure in the clamp image 68 clamp image original clamp image noise added segmented clamp image 10 iterations
  • 69. Relaxation labelling  Applying the algorithm to normal greylevel images we can see a clear separation into light and dark areas 69 Original 2 iterations 5 iterations 10 iterations
  • 70. Relaxation labelling  The histogram of each image shows the clear saturation to 0 and 255 70 0.00 1000.00 2000.00 3000.00 4000.00 5000.00 0.00 50.00 100.00 150.00 200.00 250.00 i h(i) Original 2 iterations 5 iterations 10 iterations
  • 71.  In relaxation labelling we have seen that we are representing the probability that a pixel has a certain label  In general we may imagine that an image comprises L segments (labels)  Within segment l the pixels (feature vectors) have a probability distribution represented by  represents the parameters of the data in segment l  Mean and variance of the greylevels  Mean vector and covariance matrix of the colours  Texture parameters 71 The Expectation/Maximization (EM) algorithm ) | ( l l x p  l 
  • 73. The Expectation/Maximization (EM) algorithm  Once again a chicken and egg problem arises  If we knew then we could obtain a labelling for each by simply choosing that label which maximizes  If we new the label for each we could obtain by using a simple maximum likelihood estimator  The EM algorithm is designed to deal with this type of problem but it frames it slightly differently  It regards segmentation as a missing (or incomplete) data estimation problem 73 L l l .. 1 :   ) | ( l l x p  x L l l .. 1 :   x
  • 74. The Expectation/Maximization (EM) algorithm  The incomplete data are just the measured pixel greylevels or feature vectors  We can define a probability distribution of the incomplete data as  The complete data are the measured greylevels or feature vectors plus a mapping function which indicates the labelling of each pixel  Given the complete data (pixels plus labels) we can easily work out estimates of the parameters  But from the incomplete data no closed form solution exists ) ..... , ; ( 2 1 L i x p    (.) f L l l .. 1 :  
  • 75. The Expectation/Maximization (EM) algorithm  Once again we resort to an iterative strategy and hope that we get convergence  The algorithm is as follows: 75 Initialize an estimate of Repeat Step 1: (E step) Obtain an estimate of the labels based on the current parameter estimates Step 2: (M step) Update the parameter estimates based on the current labelling Until Convergence L l l .. 1 :  
  • 76. The Expectation/Maximization (EM) algorithm  A recent approach to applying EM to image segmentation is to assume the image pixels or feature vectors follow a mixture model  Generally we assume that each component of the mixture model is a Gaussian  A Gaussian mixture model (GMM) 76    L l l l l x p x p 1 ) | ( ) | (   )) ( ) ( 2 1 exp( ) det( ) 2 ( 1 ) | ( 1 2 / 1 2 / l l T l l d l l x x x p            1 1   L l l 
  • 77. The Expectation/Maximization (EM) algorithm  Our parameter space for our distribution now includes the mean vectors and covariance matrices for each component in the mixture plus the mixing weights  We choose a Gaussian for each component because the ML estimate of each parameter in the E-step becomes linear 77   L L L     , , . ,......... , , 1 1 1    
  • 78. The Expectation/Maximization (EM) algorithm  Define a posterior probability as the probability that pixel j belongs to region l given the value of the feature vector  Using Bayes rule we can write the following equation  This actually is the E-step of our EM algorithm as allows us to assign probabilities to each label at each pixel 78 ) , | ( l j x l P  j x    L k k k k l j l l l j x p x p x l P 1 ) | ( ) | ( ) , | (     
  • 79. The Expectation/Maximization (EM) algorithm  The M step simply updates the parameter estimates using MLL estimation 79     n j m l j m l x l P n 1 ) ( ) 1 ( ) , | ( 1         n j m l j n j m l j j m l x l P x l P x 1 ) ( 1 ) ( ) 1 ( ) , | ( ) , | (               n j m l j n j T m l j m l j m l j m l x l P x x x l P 1 ) ( 1 ) ( ) ( ) ( ) 1 ( ) , | ( ) )( ( ) , | (    
  • 80. Conclusion  We have seen several examples of greylevel and colour segmentation methods  Thresholding  Clustering  Relaxation labelling  EM algorithm  Clustering, relaxation labelling and the EM algorithm are general techniques in computer vision with many applications 80