L21 ImageSegmentation 2
L21 ImageSegmentation 2
Anoop M. Namboodiri
Biometrics and Secure ID Lab, CVIT,
IIIT Hyderabad
Types of Segmentation
• Classification-based
• Label pixels based on region properties
• Label each pixel based on object models
• Region-based
• Region growing and splitting
• Boundary-based
• Find edges in the image and use them as region boundary
• Motion-based
• Group pixels that have consistent motion (e.g., move in the same
direction)
Is Intensity Histogram Sufficient?
Segmentation by Pixel Classification
Two Primary Challenges:
1. How to use object / background properties to decide on
pixel label?
• e.g., Ducks are white and yellow, while background is green and
brown
2. How to ensure that regions are continuous regions?
• Avoid fragmentation of object regions
Segmentation as Optimal Labeling
• Model knowledge about the world
• Classify each pixel as belonging to a specific object
• Independent classification does not work
• Need to incorporate neighborhood information
• Consider a graph over the image
• Each node in the graph need to be labeled
• Edges in the graph represent neighborhood constraints
• Define a cost function, Q( f ), using the above
• Compute the optimal labeling wrt Q( f ).
Binary Image Segmentation
How ?
Graph G = (V,E)
Vertex corresponds to a pixel
L = {fg, bg} Edges define grid graph
b c Graph G = ( V, E )
1
3
Discrete label set L = {1,2,…,h}
a
d
Label l0
Va Vb Vc Vd
Da Db Dc Dd
Label l0
5 2 3 7
Va Vb Vc Vd
Da Db Dc Dd
Easy to minimize
Q(f) = ∑a qa;f(a)
Unary Potential Neighbourhood
Energy Function
Label l1 2 4 6 3
Label l0
5 2 3 7
Va Vb Vc Vd
Da Db Dc Dd
Da Db Dc Dd
Pairwise Potential
Q(f) = ∑a qa;f(a) +∑(a,b) qab;f(a)f(b)
Energy Function
Label l1 2 0 4 0 6 1 3
1 1 2 3 4 1
Label l0
5 0 2 1 3 0 7
Va Vb Vc Vd
Da Db Dc Dd
2 + 1 + 2 + 1 + 3 + 1 + 3 = 13
MAP Estimation
Label l1 2 0 4 0 6 1 3
1 1 2 3 4 1
Label l0
5 0 2 1 3 0 7
Va Vb Vc Vd
5 + 1 + 4 + 0 + 6 + 4 + 7 = 27
MAP Estimation
Label l1 2 0 4 0 6 1 3
1 1 2 3 4 1
Label l0
5 0 2 1 3 0 7
Va Vb Vc Vd
Segmentation
2|V|
Segmentation
2|V|
Water Water
Water
The Watershed Algorithm
• Let M1, M2, .., MR be the regional minima.
• Let C(Mi) be points in the catchment area of Mi.
• Let T[n] represent the set of co-ordinates for which g(s,t) < n.
• Flood the topography in integer increments
• From 𝑛 = min + 1 to 𝑛 = max + 1.
• At each stage, we compute Cn(Mi) from Cn-1(Mi) and T[n]
using morphological operators
• Essentially, add pixels of value n to the corresponding C(Mi)
Watershed Example
• Watershed is often performed
on the gradient image (top
right).
Over-segmentation from Watershed
Over-segmentation from Watershed
Questions?