Image Segmentation
Image Segmentation
Segmentation
Outline & Content
1. Introduction
2. Thresholding
3. Edge-based segmentation
4. Region-based segmentation
5. conclusion
2
1. Introduction
What is segmentation?
4
Edge-based segmentation
Using mask to detect edge in image by convolution.
5
Region-based segmentation
Finding region, but not finding edge.
Region Growing
Data Clustering (Hierarchical clustering)
Partitional clustering
Cheng-Jin Kuo`s method
6
2. Thresholding
Basic Global Thresholding
1) Select an initial To
2) Segment image use:
g ( x, y ) 01 if f(x,y) T
if f(x,y) T
1
4) Compute a new threshold: T (m 1 m 2 )
2
5) Until the difference between values of T is smaller than a predefined para
meter.
7
Otsu’s Method
{0,1,2,…,L-1} , L means gray level intensity
MN n 0 n 1 n 2 ... n L 1
M*N is the total number of pixel.
n i denote the number of pixels with intensity i
we select a threshold T (k ) k , 0 k L 1 , and use it to
classify C : intensity in the range [0, k ] and C : [k 1, L 1]
k
1
L 1
2
P (k ) p , P (k ) p 1 P (k )
1 i 2 i 1
i 0 i k 1
P 1 m 1 P 2 m 2 m G , P 1 + P 2 =1
L1
= i m p , it is global variance.
2
G G
2
i
i 0
8
( m G P 1 (k ) m(k )) 2
(k ) P 1 P 2 (m1 m 2 )
2
B
2
P 1 (k )(1 P 1 (k ))
it is 2between-class variance
(k )
= B 2 , 0 (k *) 1
G
it is a measure of separability between class.
B2 (k ) max B2 (k )
o k L 1
g ( x, y ) 1 if f(x,y)k*
0 if f(x,y) k*
* * 2
( k *
(k , k ) B 12 2 ) , k *
G
1 2
10
Variable Thresholding
1) Image partitioning
.
11
2) Variable thresholding based on local image prop
erties
Let xy and m xy denote the standard deviation and m
ean value of the set of pixels contained in a neighbor
hood, . S xy
g ( x, y ) 1 if Q(local parameters) is true
0 if Q(local parameters) is true
Q ( xy , m xy ) true if f ( x , y ) a
false otherwise
xy ANDf ( x , y ) bm xy
12
3) Using moving average
It discussed is based on computing a moving average
along scan klines
1
of an image.
m(k 1) 1 z i m(k ) 1 ( z k 1 z k n )
n i k 2 n n
z k 1 denote the intensity of the point at step k+1.
n denote the number of point used in the average.
m(1) z 1 / n is the initial value.
T xy bm xy ,where b is constant and is the moving a
verage at point (x,y)
13
3. Edge-based segmentation
Basic Edge Detection
Why we can find edge by difference?
image
intensity
first-order deviation
second-order deviation
First-order produce
deviation thicker edges
15
Roberts cross-gradient operators:
Prewitt operator:
Sobel operator:
G ( x, y ) 1
0
if R ( x , y ) T
otherwise
16
The Marr-Hildreth edge detector(LoG)
This is second-order deviation, we call Laplacian.
g ( x, y ) [ 2G ( x, y )] f ( x, y ) g ( x, y ) 2 [G ( x, y ) f ( x, y )]
Filter the input image with an n*n Gaussian lowpass fi
lter. 99.7% of the volume under a 2-D Gaussian surface
lies between about the mean. So . n 6
17
Short response Hilbert Transform(SRHLT)
1) Hilbert transform
1
g H ( ) h( x) * g ( x), where h( x)
x
GH ( f ) H ( f )G ( f ) , H ( f ) j sgn( f )
18
2) SRHLT
g H hb x g x , where hb x b csch( bx )
GH ( f ) H b ( f )G ( f ) where GH ( f ) FT [ g H ( )],
G ( f ) FT [ g ( )], H b ( f ) j tanh( f / b).
Choose a suitable
HLT value differentiation
b0 b
Lower b Higher b
Impulse response Longer Shorter
Noise robustness Good Bad
Type of edge Ramp Step
Output Thick Sharp
19
Simulation result
20
Watersheds
Algorithm:
T [n] {( s, t ) | g ( s, t ) n} , g(s,t) is intensity.
n= min+1 to n = max +1. And let T[n]=0, others 1.
R
C[n] C ( M ) ,C ( M ) is minimum point beneath n.
n i n i
i 1
21
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.
22
4. Region-based segmentation
Region Growing
Algorithm:
a. Choose a random pixels
b. Use 8-connected and threshold to determine
c. Repeat a and b until almost points are classified.
23
Simulation of region growing (90% pixels )
Threshold/second: 20/4.7 seconds.
24
Data Clustering
25
Hierarchical clustering
1) Algorithm of hierarchical agglomeration(built)
: Ci
A. See every single data as a cluster .
Ci Cj
B. Find out , for the distance is the shortest.
26
2) Algorithm of hierarchical division (break up ) :
Diameter of cluster
D(Ci ) max(d (a,b)) , for a Ci , b Ci
27
1) See the whole database as one cluster.
2) Find out the cluster having the biggest diameter
3) max (d ( x, c)) , for x C .
4) Split out x as a new cluster C1 , and see the rest data
points as Ci .
5) If d ( y, Ci ) > d ( y, C1 ) , for y Ci then split y out of Ci and c
lassify it to C1
6) Back to step2 and continue the algorithm until C1 an
d Cisi not change anymore.
28
Partitional clustering
Decide the numbers of the cluster(k-means)
Problem:
Initial problem
29
Number of regions are more than clusters you set.
31
Advantage and disadvantage of data clustering
Hierarchical Partitional
algorithm algorithms
advantage 1.Concept is simple 1.Computing speed
is fast.
2. Result is reliable. 2.Numbers of
cluster is fixed, so
the concept is also
simple.
32
Cheng-Jin Kuo`s method
Algorithm
33
1) Adaptive threshold decision with local variance
(4,1)
High frequency, low variance. Set second high thresho
ld.
(4,2)
Low frequency, high variance. Set third high threshold
.
(1,4)
Low frequency, low variance. Set the lowest threshold.
(1,1)
36
Comparison of all algorithm by data compr
ession
Region K-means Watershed Cheng-Jin
growing Kuo`s
method
Speed bad Good(worse bad Good
than C.J.K’s
method)
Shape intact fragmentary oversegmen Intact
connectivi tation
ty
Shape Good(better Good(equal bad Good
match than C.J.K’s C.J.K’s
method) method)
37
Conclusion
Speed
Connectivity
System reliability
38
Reference
1. R. C. Gonzalez, R. E. Woods, Digital Image Processin
g third edition, Prentice Hall, 2010.
2. C. J. Kuo, J. J. Ding, Anew Compression-Oriented Fas
t image Segmentation Technique, NTU,2009.
39
Q&A
40