Image Segmentation Graph Cut
Image Segmentation Graph Cut
(Optimization Problem)
1
Labeling & Segmentation
• Labeling is a common way for modeling
various computer vision problems (e.g.
optical flow, image segmentation, stereo
matching, etc)
• The set of labels can be discrete (as in
image segmentation)
L = {l1, . . . , l m } with L = m
L⊂ Rn for n ≥ 1 2
Labeling is a function
• Labels are assigned to sites (pixel locations)
• For a given image, we have 𝛺 =N c o l s .N ro w s
• Identifying a labeling function
(with segmentation) is f : 𝛺 →L
3
Energy Function
The role of an energy function in
minimization-based vision is twofold:
5
Segmentation as an Energy Minimization Problem
6
Segmentation as an Energy Minimization Problem
7
Energy Function-Details
8
Energy Function-Details
9
Energy Function
Unary Cost
(data term)
Discontinuity
Cost
p q 2
1
Recap: Image as a Graph
p q Edg
e Node/verte
pixe x
l
2
2
Graph Cuts for Optimal Boundary Detection
(Boykov ICCV 2001)
F
B 15
Cost Function: Data term
• Put one edge between each pixel and both
F &G
• Weight of edge = minus data term
F
B 16
Cost Function: Smoothness term
• Add an edge between each neighbor
pair
• Weight = smoothness term
F
B 17
Min-Cut
• Energy optimization equivalent to graph min
cut
• Cut: remove edges to disconnect F from B
• Minimum: minimize sum of cut edge weight
F cut
B 2
9
Min-Cut
Source
2 9 Graph (V, E, C)
1 Vertices V = {v1, v2 ... vn}
Sink
19
Min-Cut
What is a st-cut?
An st-cut (S,T) divides the nodes
between source and sink.
Source
Sink
5 + 2 + 9 = 16 20
Min-Cut
What is a st-cut?
An st-cut (S,T) divides the nodes
between source and sink.
Source
5 + 2 + 9 = 16 21
How to compute min-cut?
Solve the dual maximum flow problem
Compute the maximum flow between
Source Source and Sink
Constraints
2 9
Edges: Flow < Capacity
1
v1 v2 Nodes: Flow in & Flow out
2
5 4
Min-cut\Max-flow Theorem
Sink
In every network, the maximum flow
equals the cost of the st-mincut
22
Max-Flow Algorithms
Flow = 0
Augmenting Path Based
Algorithms
Source
E(x) x*
wpq
t=1