Professional Documents
Culture Documents
Segmentation: Image Processing - Lesson 12
Segmentation: Image Processing - Lesson 12
Segmentation
• Threshold Segmentation
• Local thresholding
• Edge thresholding
• Threshold using averaging
• Gradient Detectors
• Region Growing
• Split & Merge
• Shape Matching
• Shape Representation
Segmentation
1) Region Based
2) Boundary Based
3) Edge Based
Thresholding
Image Histogram
# of Pixels
Background
Object
Graylevel
T
Segmentation using Thresholding
Original Histogram
1500
1000
500
0
0 100 200
50 75
Threshold = 50 Threshold = 75
Original Histogram
1500
1000
500
0
0 100 200
21
Threshold = 21
Thresholding a Grayscale Image
Threshold = 71 Threshold = 88
Simple thresholding is not always possible:
Image Histogram
# of Pixels
Graylevel
Original Histogram
150
100
50
0
0 100 200
100
50
0
0 100 200
T = 128
Local Thresholding - 4 Thresholds
Divide image in to regions. Perform thresholding
independently in each region.
50 50 50 50
0 0 0 0
0 100 200 0 100 200 0 100 200 0 100 200
T=
Threshold Level
200
100
0
0 50 100
x-coordinate
Adaptive Thresholding - Example
Original
Image Histogram
# of Pixels
Graylevel
Image Histogram
# of Pixels
Graylevel
T
Note: Smooth the image, not the histogram...
Image Histogram
# of Pixels
Graylevel
Image Histogram
# of Pixels
Graylevel
Threshold using Average
5000
0
0 50 100 150 200 250
Gray level
Threshold using Average
100
400
no pixels
50
200
0 0
0 50 100 150 200 250 0 50 100 150 200 250
Background Object
Edge Based Thresholding
150
100
50
0
0 50 100 150 200 250
Thresholding Based on
Boundary Characteristics
3000
2000
1000
0
0 100 200
Global Histogram
Thresholding Based on
Boundary Characteristics
20
15
10
0
0 100 200
Define:
S = the set of pixels inside the region.
Q = queue of pixels to be checked.
(x0,y0) = a pixel inside the region.
Algorithm:
Initialize: S = ∅
Q = { (x0,y0) }
1) Extract pixel P from queue Q
2) Add P to S.
3) For each neighbor P' of P:
if P' is "similar" to P and P' ∉ S then
add P' to Q.
4) If Q = ∅ then end, else return to 1.
Seed
Region Growing - Examples
Color Segmentation
Texture Segmentation
Tn
T0
Image location
Watershed Threshold Algorithm
Tn
T0
Image location
2 Stage Algorithm:
Stage 1: Split
Split image into regions using a Quad Tree
representation.
Stage 2: Merge
Merge "leaves" of the Quad Tree which are
neighboring and "similar".
1 2
1 2 3 4
3 4
Demo
Quad Tree Representation
Original
Thresh = 0.20
Thresh = 0.40
Thresh = 0.55
Split & Merge Example
Stage 1: Split
Stage 2: Merge
Split & Merge Example
Graph-Cut Segmentation
Wij
Wij j
i
G={V,E}
cut
A
B
cut ( A , B ) = ∑W
i∈A , j∈B
ij
Segmentation by min-cut:
cut
Segmentation by normalized-cut:
⎛ 1 1 ⎞
Ncut ( A , B ) = ∑ W ij ⎜⎜ + ⎟⎟
i∈A , j∈B ⎝ vol ( A ) vol ( B ) ⎠
where vol ( A ) = ∑W
i∈A , j∈A
ij
? ? ? ?