5. 2. Thresholding
Basic Global Thresholding
1) Select an initial To
2) Segment image use:
3) Compute the average intensity
and for the pixels in and .
7) Compute a new threshold:
8) Until the difference between values of T is smaller than a predefined parameter.
{ 1 if f(x,y)
0 if f(x,y) T( , ) T
g x y ≥
≤=
1m
2m
1 2
1
( )
2
T m m= +
6. Otsu’s Method
{0,1,2,…,L-1} , L means gray level intensity
M*N is the total number of pixel.
denote the number of pixels with intensity
we select a threshold , and use it to
classify : intensity in the range and :
,
,
, it is global variance.
in i
0 1 2 1... LMN n n n n −= + + + +
( ) ,0 1T k k k L= < < −
1C 2C[0, ]k [ 1, 1]k L+ −
1
0
( )
k
i
i
P k p
=
= ∑
1
2 1
1
( ) 1 ( )
L
i
i k
P k p P k
−
= +
= = −∑
1 1 2 2 GP m P m m+ = 1 2+ =1P P
( )
1
22
G
0
=
L
G i
i
i m pσ
−
=
−∑
7.
it is between-class variance
,
it is a measure of separability between class.
For x = 0,1,2,…,M-1 and y = 0,1,2…,N-1.
Using image Smoothing/Edge to improve Global Thre
shold
2 2
B 1 2 1 2( ) ( )k P P m mσ = − =
2
1
1 1
( ( ) ( ))
( )(1 ( ))
Gm P k m k
P k P k
−
−
2
B
2
G
( )
=
kσ
η
σ
2 2
B B
1
( ) max ( )
o k L
k kσ σ∗
≤ ≤ −
=
{1 if f(x,y) k*
0 if f(x,y) k*( , )g x y ≥
≤=
0 ( *) 1kη≤ ≤
Smoothing Edge
detection
What situation is
more suitable for the
method
Large object we
are interested.
Small object we
are interested
8. Multiple Threshold
As Otsu’s method, it takes more area and k*
Disadvantage: it becomes too complicate when number of ar
ea more than three.
2 2 2 2
B 1 1 2 2 3 3( ) ( ) ( )G G GP m m P m m P m mσ = − + − + −
1 1 2 2 3 3 GP m P m P m m+ + =
1 2 3+ +P =1P P
1 2
2 * * 2
B 1 2 B 1 2
1
( , ) max ( , )
o k k L
k k k kσ σ
< < < −
=
2 * *
* * B 1 2
1 2 2
G
( , )
( , )
k k
k k
σ
η
σ
=
9. Variable Thresholding
1) Image partitioning
.
)It works when the objects of interest and the backgro
und occupy regions of reasonably comparable size. If
not , it will fail.
10. Watersheds
Algorithm:
, g(s,t) is intensity.
n= min+1 to n = max +1. And let T[n]=0, others 1.
, is minimum point beneath n.
[ ] {( , ) | ( , ) }T n s t g s t n= <
1
[ ] ( )
R
n i
i
C n C M
=
= U ( )n iC M
11. Markers
External markers:
Points along the watershed
line along highest points.
Internal markers:
(1) That is surrounded higher points .
(2) Points in region form a connected component
(3) All points in connected component have the same
intensity.