SLIDE 8 CS 376: Lecture 9 2/14/2018 8 Snake energy: pair-wise interactions
2 1 1 2 1 1
| ) , ( | | ) , ( | ) , , , , , (
i i y n i i i x n n total
y x G y x G y y x x E
2 1 1 1 2 1
) ( ) (
i i n i i i
y y x x
1 1 2 1
|| ) ( || ) , , (
n i i n total
G E
1 1 2 1
|| ||
n i i i
) , ( ... ) , ( ) , ( ) , , (
1 1 3 2 2 2 1 1 1 n n n n total
v v E v v E v v E E
2 1 2 1
|| || || ) ( || ) , (
i i i i i i
G E
where
Re-writing the above with :
i i i
y x v , ) , (
4 4 n
v v E ) , (
4 3 3
v v E ) 3 (
3
E ) (
3 m
E ) (
4 m
E ) 3 (
4
E ) 2 (
4
E ) 1 (
4
E ) (m En ) 3 (
n
E ) 2 (
n
E ) 1 (
n
E ) 2 (
3
E ) 1 (
3
E ) (
2 m
E ) 3 (
2
E
) , ( ... ) , ( ) , (
1 1 3 2 2 2 1 1 n n n total
v v E v v E v v E E
) , (
3 2 2
v v E ) 1 (
2
E ) 2 (
2
E ) , (
2 1 1
v v E ) 1 (
1
E ) 2 (
1
E ) 3 (
1
E ) (
1
m E
Main idea: determine optimal position (state) of predecessor, for each possible position of self. Then backtrack from best state for last vertex.
states 1 2 … m vertices 1
v
2
v
3
v
4
v
n
v
) (
2
nm O
Complexity:
- vs. brute force search ____?
Viterbi algorithm
Example adapted from Y . Boykov
1
v
2
v
3
v
4
v
6
v
5
v With this form of the energy function, we can minimize using dynamic programming, with the Viterbi algorithm. Iterate until optimal position for each point is the center
- f the box, i.e., the snake is optimal in the local search
space constrained by boxes.
[Amini, Weymouth, Jain, 1990] Fig from Y. Boykov
Energy minimization: dynamic programming
) , ( ... ) , ( ) , (
1 1 3 2 2 2 1 1 n n n
v v E v v E v v E
DP can be applied to optimize an open ended snake For a closed snake, a “loop” is introduced into the total energy.
1
n
) , ( ) , ( ... ) , ( ) , (
1 1 1 3 2 2 2 1 1
v v E v v E v v E v v E
n n n n n
1
n
2
1 n
3
4
Work around: 1) Fix v1 and solve for rest . 2) Fix an intermediate node at its position found in (1), solve for rest.
Energy minimization: dynamic programming
Aspects we need to consider
- Representation of the contours
- Defining the energy functions
– External – Internal
- Minimizing the energy function
- Extensions:
– Tracking – Interactive segmentation
Tracking via deformable contours
- 1. Use final contour/model extracted at frame t as
an initial solution for frame t+1
- 2. Evolve initial contour to fit exact object boundary
at frame t+1
- 3. Repeat, initializing with most recent frame.
Tracking Heart Ventricles (multiple frames)