Professional Documents
Culture Documents
CS 4487/9587
Deformable Models
Acknowledgements: many slides from the University of Manchester,
demos from Visual Dynamics Group (University of Oxford),
5-1
The University of
4 1
3
2
5-4
The University of
5-6
The University of
5-8
The University of
gradient descent w.r.t. some
function describing snake’s quality
“Snakes” Ontario
x R1
x̂ x2 x1 x0
Note: in computer vision and medical imaging the term “snake” is commonly associated with
such parametric representation of contours. (Other representations will be discussed later!)
( xn , yn )
2n
Here, contour is a point in R _
C ( ν i | 0 i n ) ( x0 , y0 , x1 , y1 ,...., xn1 , yn1 )
5-12
The University of
2n
Contours can be seen as points C in R (or in R )
E Ein Eex
Internal energy encourages
smoothness or any particular shape External energy encourages curve onto
image structures (e.g. image edges)
Internal energy incorporates prior
knowledge about object boundary
allowing to extract boundary even if
some image data is missing
5-14
The University of
Internal Energy
(continuous case) Ontario
d d
2
2
Ein ( ( s )) ( s ) ( s)
2
ds d s
Elasticity/stretching Stiffness/bending
Internal Energy
(discrete case) Ontario
C ( ν 0 , ν 1 , ν 2 ,...., ν n 1 ) 2n
v4
elastic energy v3 ν i ( xi , yi )
(elasticity) v5
v2
d
vi 1 i
ds v1 v6
v 10 v7
v9 v8 bending energy
(stiffness)
d 2
2
( i 1 i ) ( i i 1 ) i 1 2 i i 1
ds
The University of
Internal Energy
(discrete case) Ontario
C ( ν 0 , ν 1 , ν 2 ,...., ν n 1 ) 2n
d ν i ( xi , yi )
vi 1 i
ds
d 2
2
( i 1 i ) ( i i 1 ) i 1 2 i i 1
ds
n 1
Ein i 0
| i 1 i | | i 1 2 i i 1 |
2 2
Elasticity Stiffness
5-17
The University of
5-18
The University of
1 1
dv 2
E | | ds | I ( v( s )) | ds
2 continuous case
C { ν( s ) | s [ 0 ,1 ]}
0
ds 0
n 1 n 1
E | vi 1 vi | 2
| I ( vi ) | 2 discrete case
C { νi | 0 i n }
i 0 i 0
5-20
The University of
n 1
Li
2 This can make a curve shrink i
Ein i-1 i+1
(to a point) Li-1 Li
i 0
Li+1
n 1 i+2
( xi 1 xi ) 2 ( yi 1 yi ) 2
i 0
C
n 1
Eex | I ( xi , yi ) |2
i 0
n 1
| I x ( xi , yi ) |2 | I y ( xi , yi ) |2
i 0
5-21
The University of
5-22
The University of
(1) (2)
(3) (4)
5-23
The University of
5-24
The University of
i 0
5-26
The University of
i 0
5-27
The University of
5-29
The University of
5-32
The University of
0 n 0 open curve
n 1
closed curve
n 1 n2
Ein (
i 0
i 1 i )
2
Ein (
i 0
i 1 i ) 2
Optimization Methods
1. Gradient Descent
2. Dynamic Programming
5-34
The University of
Ex
( x0 , y0 ) E E
y
y
x
update equation for a point p=(x,y)
p p t E
( x0 , y0 )
y
x x Ex
t E
y y y
Stop at a local minima where E 0 5-36
The University of
C' C E t
x'0 x0 x0
E
C 0 0
y ' y E
y0
... ... ... t
E
x' n 1 xn 1 xn1
y' n 1 yn 1 ynE1
5-38
The University of
update equation for each node
xEi
ν'i ν i Fi t Fi E
Fi yi
x'0 x0 x0
E
C 0 0
y ' y E
y0
... ... ... t
E
x' n 1 xn 1 xn1
y' n 1 yn 1 ynE1
5-39
The University of
update equation for each node
xEi
ν'i ν i Fi t Fi E = ?
Fi yi
C E
xi 2 I x I xx 2 I y I yx 2 ( xi 1 xi ) 2 ( xi xi 1 )
E
yi 2 I x I xy 2 I y I yy 2 ( yi 1 yi ) 2 ( yi yi 1 )
Q: Do points move independently?
NO, motion of point i depends on positions of neighboring points 5-40
The University of
update equation for each node
xEi
ν'i ν i Fi t Fi E = ?
Fi yi
C E
xi 2 I x I xx 2 I y I yx 2 ( xi 1 xi ) 2 ( xi xi 1 )
E
yi 2 I x I xy 2 I y I yy 2 ( yi 1 yi ) 2 ( yi yi 1 )
update equation for each node
xEi
ν'i ν i Fi t Fi E = ?
Fi yi
C 2
d v
This term for vi
Fi (| I |2 ) 2 depends on
neighbors
( xi , yi ) d 2s
vi-1 and vi+1
motion of vi towards higher motion of vi reducing
magnitude of image gradients contour’s bending 5-42
The University of
Discrete Snakes:
“Gradient Flow” evolution Ontario
dC dt E
Contour evolution via
“Gradient flow”
update equation for each node
i' ν'i ν i Fi t i 0 , , n 1
i
C Stopping criteria:
Fi 0 for all i E 0
C’
local minima of energy E
5-43
The University of
5-45
The University of
Snake energy:
pair-wise interactions Ontario
i 0 i 0
n 1
Etotal ( 0 ,, n 1 ) E ( ,
i 0
i i i 1 )
where Ei ( i , i 1 ) || I ( i ) || || i i 1 ||
2 2
DP Snakes
[Amini, Weymouth, Jain, 1990] Ontario
v3 v2
v1
v4 v6
v5
control points
First-order interactions
E (v1 , v2 ,..., vn ) E1 (v1 , v2 ) E2 (v2 , v3 ) ... En1 (vn1 , vn )
Energy E is minimized via Dynamic Programming
5-47
The University of
DP Snakes
[Amini, Weymouth, Jain, 1990] Ontario
v3 v2
v1
v4 v6
v5
control points
First-order interactions
E (v1 , v2 ,..., vn ) E1 (v1 , v2 ) E2 (v2 , v3 ) ... En1 (vn1 , vn )
Energy E is minimized via Dynamic Programming
Iterate until optimal position for each point is the center of the box,
i.e. the snake is optimal in the local search space constrained by boxes
5-48
The University of
v1 v2 v3 v4 vn
states
E1 (1) 0 E2 (1) E3 (1) E4 (1) E n (1)
1
E1 (2) 0 E2 (2) E3 ( 2 ) E4 (2) En (2)
2
E1 (3) 0 E2 (3) E3 (3) E4 (3) En (3)
…
E1 (4) 0 E2 (4) E3 ( 4 ) E4 (4) En (4)
m
2
Complexity: O(nm ), Worst case = Best Case5-49
The University of
time
word1 word2 word3 word4
ordered (in time) hidden variables (words) to be estimated from observed signal
1
n
|| I ( i ) || Eelastic( i , i 1 )
5-51
The University of
Dynamic Programming
for a closed snake? Ontario
Dynamic Programming
for a closed snake Ontario
Dynamic Programming
for a closed snake Ontario
Dynamic Programming
for snakes with higher order interactions Ontario
5-57
The University of
image gradients I
are large only directly on the boundary 5-59
The University of
Alternative Way to
Improve External Energy Ontario
n 1 n 1
Use Eex D( v i ) instead of Eex | I ( v i ) | where D() is
i 0 i 0
Distance Transform
(see p.20-21 of the text book) Ontario
Distance Transform
can be very efficiently computed Ontario
5-63
The University of
Distance Transform
can be very efficiently computed Ontario
5-64
The University of
Distance Transform
can be very efficiently computed Ontario
5-65
The University of
Distance Transform:
an alternative way to think about Ontario
For general F ( p )
D( p) min { || p q || F (q)}
q
q p
F(p) may represent non-binary image features (e.g. image intensity gradient)
5-67
The University of
Metric properties of
discrete Distance Transforms Ontario
- 1 0 1
Manhattan (L1) metric
1 0 1 -
1.4 1 1.4 0 1
Better approximation
1 0 1.4 1 1.4 of Euclidean metric
HW assignment 2 Ontario
DP Snakes
• Use elastic snake model E Eint l Eext (value of l is important)
n 1 n 1
i 0 n 1 i 0 n 1
• Compare Eint Li Eint | Li |
2
vs.
n 1 i 0 i 0 n 1