An Introduction of Image
Segmentation
主講者 : 陳建齊
Outline & Content
1. Introduction
2. Thresholding
3. Edge-based segmentation
4. Region-based segmentation
5. conclusion
2
1. Introduction
What is segmentation?
Three major ways to do.
Thresholding
Edge-based segmentation
Region-based segmentation
3
Thresholding
Finding histogram of gray level intensity.
Basic Global Thresholding
Otsu’s Method
Multiple Threshold
Variable Thresholding
4
Edge-based segmentation
Using mask to detect edge in image by convolution.
Basic Edge Detection
The Marr-Hildreth edge detector(LoG)
Short response Hilbert transform(SRHLT)
Watersheds
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
3) Compute the average intensity
m1
m2
and for the pixels in and .
1
T (m 1 m 2 )
4) Compute a new threshold: 2
5) Until the difference between values of T is smaller than a predefined
parameter.
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]
1 2
k L 1
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
= i m p , it is global variance.
L 1
2 2
G G 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
= B (2k ) , 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*
For x = 0,1,2,…,M-1 and y = 0,1,2…,N-1.
Using image Smoothing/Edge to improve Global
Threshold
Smoothing Edge
detection
What situation is Large object we Small object we
more suitable for the are interested. are interested
method
9
Multiple Threshold
As Otsu’s method, it takes more area and k*
2 P (m m ) 2 P (m m ) 2 P (m m ) 2
B 1 1 G 2 2 G 3 3 G
P 1m1P 2 m 2 P 3 m 3 m G
P 1 + P 2 +P 3 =1
B2 (k1* , k2* ) max B2 (k 1 , k 2 )
o k 1 k 2 L 1
2
(k1* , k2* ) B 1 2 )
( k *
, k *
G2
Disadvantage: it becomes too complicate when
number of area more than three.
10
Variable Thresholding
1) Image partitioning
.
It is work when the objects of interest and the
background occupy regions of reasonably comparable
size. If not , it will fail.
11
2) Variable thresholding based on local image
properties
Let xy and m xy denote the standard deviation and
mean value of the set of pixels contained in a
neighborhood, S xy .
g ( x, y ) 10 ifif Q(local
Q(local parameters) is true
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
average 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
Second-order stronger double-edge Determine edge
deviation response to fine response is from light to
detail dark or dark to
light
14
1) Gradient
The image gradient is to find edge strength and direction
at location (x,y) of image.
f
g x x
f grad( f )
g y f
y
The magnitude (length) of vector , denoted as M(x,y):
mag(f ) g x g y
The direction of the gradient vector
g y is given by the angle:
( x, y ) tan 1
g x
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
filter. 99.7% of the volume under a 2-D Gaussian
surface lies between about the mean. So n 6 .
17
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.
18
Simulation of region growing (90% pixels )
Threshold/second: 20/4.7 seconds.
19
Reference
1. R. C. Gonzalez, R. E. Woods, Digital Image
Processing third edition, Prentice Hall, 2010.
2. C. J. Kuo, J. J. Ding, Anew Compression-Oriented
Fast image Segmentation Technique, NTU,2009.
20