Segmentation
Segmentation
Introduction
The objective is to subdivide an image into its
constituent parts or objects for subsequent
Introduction processing such as recognition.
Detection of Discontinuities It is one of the most important steps leading to the
Point detection analysis of processed image data.
Line detection
Edge detection
Combined detection Complete v.s. patrial segmentation
Edge linking and boundary detection In complete segmentation,
Thresholding Disjoint regions segmented are uniquely
Adaptive thresholding corresponding with objects in the input image.
Threshold selection based on boundary Cooperation with higher processing levels which
&<+,PDJH6HJPHQWDWLRQS &<+,PDJH6HJPHQWDWLRQS
2.1 Point detection 2.2 Line detection
A point has been detected at the location p(i,j) on
which the mask is centered if |R |>T, where T is a
Line masks
nonnegative threshold, and R is obtained with the
1 1 1
following mask. 2
Horizontal line 2 2
1 1 1 1 1 1
1 8 1
1 1 2
1 1 1 45$ line 1 2 1
The idea is that the gray level of an isolated point 2 1 1
will be quite different from the gray level of its 1 2 1
neighbors. Vertical line 1 2 1
1 2 1
2 1 1
- 45$ line 1 2 1
1 1 2
2ULJLQDO 1RLVHDGGHG If, at a certain point in the image, |Ri|>|Rj| for all
j i , that point is said to be more likely associated
with a line in the direction of mask i.
)LOWHUHGRS 7KUHVKROGHGRS
&<+,PDJH6HJPHQWDWLRQS &<+,PDJH6HJPHQWDWLRQS
2.3 Edge detection
It locates sharp changes in the intensity function.
Edges are pixels where brightness changes abruptly.
A change of the image function can be described by
a gradient that points in the direction of the largest
growth of the image function.
2ULJLQDO
An edge is a property attached to an individual pixel
and is calculated from the image function behavior
in a neighborhood of the pixel.
Magnitude of the first derivative detects the
presence of the edge.
Sign of the second derivative determines whether
the edge pixel lies on the dark sign or light side.
+RUL]RQWDOOLQH ROLQH
9HUWLFDOOLQH ROLQH
&<+,PDJH6HJPHQWDWLRQS &<+,PDJH6HJPHQWDWLRQS
(a) Gradient operator
f 2 f 2
2
f ( x ' , y ' ) = +
x y
)LJ (GJHGHWHFWLRQE\GHULYDWLYHRSHUDWRUVDOLJKW
( x ', y ' )
VWULSHRQDGDUNEDFNJURXQGEGDUNVWULSHRQD
OLJKWEDFNJURXQG
Direction of the vector f ( x' , y ' ) :
( x' , y ' ) = tan 1 (fy f
x
) ( x ', y ' )
&<+,PDJH6HJPHQWDWLRQS &<+,PDJH6HJPHQWDWLRQS
Sobel operator: (b) Laplacian Operator
It provides both a differentiating and a smoothing The Laplacian of a 2D function f(x,y) is a 2nd-order
effect, which is particularly attractive as derivatives derivative defined as
typically enhance noise. 2 f 2 f
f ( x' , y ' ) = 2 + 2
2
x y ( x' , y ' )
1 2 1 1 0 1
Gx : 0 0 0 Gy : 2 0 2 The Laplacian has the same properties in all
directions and is therefore invariant to rotation in
1 2 1 1 0 1 the image.
&<+,PDJH6HJPHQWDWLRQS &<+,PDJH6HJPHQWDWLRQS
2.4 Combined Detection:
edge direction. 2 1 0 0 1 2
The Laplacian usually plays the secondary role of Basis of line subspace :
detector for establishing whether a pixel is on the 1 0 1 0 1 0
W5= 0 0 0 W6= 1 1
dark or light side of an edge. 1 1
0
2 2
1 0 1 0 1 0
1 2 1 2 1 2
1
4 2
1
W7= 2 W8= 1 4 1
6 6
1 2 1 2 1 2
&<+,PDJH6HJPHQWDWLRQS &<+,PDJH6HJPHQWDWLRQS
1 1 1
W9= 1 1 1
1
"Average" subspace : Example:
3
4 7 1
1 1 1
What's the attribute of the center of 3 5 2 ?
Given a 3x3 region represented by {f(i,j)|-2<i,j<2}, 2 0 0
we have
R1 = 4.5607 R2 = 2.2678
1 1
Rm = f (i, j ) wm (i, j ) R3 = -2.6213 R4 = -0.8284
i = 1 j = 1 R5 = -0.5000 R6 = 1.0000
1/ 2
Pline = Rm R7 = 0.5000 R8 = 3.0000
8 2
m =5 R9 = 8.0000
1/ 2
4
Pedge = Rm
2
m =1 Pedge = 5.7879
Paverage = R9 Pline = 3.2404
Paver = 8.0000
where Pline , Paverage and Pedge are the magnitudes of the
projections onto edge, line and average subspaces
respectively, which tell how likely it is associated
with either an edge, a line or nothing.
&<+,PDJH6HJPHQWDWLRQS &<+,PDJH6HJPHQWDWLRQS
2.5 Edge linking and boundary detection A point (x',y') in the neighborhood of (x,y) is linked
to the pixel at (x,y) if both the following magnitude
The techniques of detecting intensity discontinuities
and direction criteria are satisfied.
yield pixels lying only on the boundary between
regions.
f ( x' , y ' ) f ( x, y ) Threshold Tm
In practice, this set of pixels seldom characterizes a ( x' , y ' ) ( x, y ) Threshold Td
boundary completely because if noise, breaks in
boundary from nonuniform illumination, and other
effects that introduce spurious intensity
discontinuities.
Edge detection algorithms are typically followed by
linking and other boundary detection procedures
designed to assemble edge pixels into meaningful
boundaries.
D
(a) Local processing
&<+,PDJH6HJPHQWDWLRQS &<+,PDJH6HJPHQWDWLRQS
3. Thresholding Special cases:
If T depends on
Thresholding is one of the most important 1. f(x,y) only - global threshold
approaches to image segmentation. 2. Both f(x,y) & p(x,y) - local threshold
3. (x,y) - dynamic threshold
If background and object pixels have gray levels
grouped into 2 dominant modes, they can be Multilevel thresholding is in general less reliable as
separated with a threshold easily. it is difficult to establish effective thresholds to
isolate the regions of interest.
Refer PPT
+LVWRJUDP
)LJ1RQDGDSWLYHWKUHVKROGLQJUHVXOW
&<+,PDJH6HJPHQWDWLRQS &<+,PDJH6HJPHQWDWLRQS
3.1 Adaptive thresholding
&<+,PDJH6HJPHQWDWLRQS &<+,PDJH6HJPHQWDWLRQS
3.2 Threshold selection based on boundary
0 if G[ f ( x, y )] < T
characteristics
s ( x, y ) = 1 if G[ f ( x, y )] T and L[ f ( x, y )] 0
A reliable threshold must be selected to identify the 1 if G[ f ( x, y )] T and L[ f ( x, y )] < 0
mode peaks of a given histogram.
This capability is very important for automatic where T is a threshold.
threshold selection in situations where image
characteristics can change over a broad range of
intensity distributions.
&<+,PDJH6HJPHQWDWLRQS &<+,PDJH6HJPHQWDWLRQS
4.1 Region growing by pixel aggregation
Region growing is a procedure that groups pixels or
subregions into larger regions.
Pixel aggregation starts with a set of "seed" points
from those grows by appending to each seed point
those neighboring pixels that have similar properties D E F
such as gray level, texture and color. )LJ 2ULJLQDOLPDJHZLWKVHHGSRLQWEHDUO\VWDJHRI
UHJLRQJURZWKFILQDOUHJLRQ
0 0 5 6 7 a a b b b
1 1 5 8 7 a a b b b
0 1 6 7 7 a a b b b
2 0 7 6 6 a a b b b
0 1 5 6 5 a a b b b Problems have to be resolved:
Original intensity array Result of threshold=3
1. Selection of initial seeds that properly represent
a
a
a
a
a
a
b
b
b
b
a
a
a
a
a
a
a
a
a
a
regions of interest.
a a b b b a a a a a
a a b b b a a a a a 2. Selection of suitable properties for including
a a a b ? a a a a a
points in the various regions during the growing
Result of Threshold=5.5 Result of threshold=9
process.
([DPSOHRIUHJLRQJURZLQJXVLQJNQRZQVWDUWLQJSRLQWV 3. The formulation of stopping rule.
&<+,PDJH6HJPHQWDWLRQS &<+,PDJH6HJPHQWDWLRQS
4.2 Region splitting and merging Example:
To subdivide an image initially into a set of
arbitrary, disjointed regions and then merge and/or
split the regions in an attempt to satisfy the
conditions stated above.
A split and merge algorithm is summarized by the (a) (b) (c) (d)
following procedure in which, at each step, we:
(1) split into 4 disjointed quadrants any regions
([DPSOHRIVSOLWDQGPHUJHDOJRULWKP
Ri where P( Ri ) =false;
(2) merge any adjacent regions Rj and Rk for
which P( Ri R j ) =true; and
(3) stop when no further merging or splitting is
possible. (a) The entire image is split into 4 quadrants.
(b) Only the top left region satisfies the predicate
so it is not changed, while the other 3 quadrants
R
are split into subquadrants.
R1 R2
)LJ3DUWLWLRQHGLPDJHDQGFRUUHVSRQGLQJTXDGWUHH
&<+,PDJH6HJPHQWDWLRQS &<+,PDJH6HJPHQWDWLRQS
D E F
)LJ D2ULJLQDOLPDJHE5HVXOWRIVSOLWDQGPHUJH
DOJRULWKPF5HVXOWRIWKUHVKROGLQJE
&<+,PDJH6HJPHQWDWLRQS