Gabriel Peyré
January 01, 2011
1k

# Mesh Processing Course: Active Contours

January 01, 2011

## Transcript

1. Active Contours
Gabriel Peyré
www.numerical-tours.com

2. Overview
•Parametric Edge-based Active
Contours
• Implicit Edge-based Active Contours
• Region-based Active Contours
2

3. Parametric Active Contours
3
– Closed curve: (0) = (1).
– Open curve: (0) = x0
and (1) = x1
.
Boundary conditions:
Local minimum: argmin E( ) = L( ) + ⇥R( )
Regularization
Data
ﬁdelity
x0
x1

4. Parametric Active Contours
3
– Closed curve: (0) = (1).
– Open curve: (0) = x0
and (1) = x1
.
Boundary conditions:
R( ) =
1
0
|| (t)|| + µ|| (t)||dt
Snakes energy: (depends on parameterization)
L( ) =
1
0
W( (t))|| (t)||dt,
Local minimum: argmin E( ) = L( ) + ⇥R( )
Regularization
Data
ﬁdelity
x0
x1
Image f Weight W(x) Curve

5. Geodesic Active Contours
4
Geodesic active contours: (intrinsic) Replace W by W + ,
E( ) = L( ) =
1
0
W( (t))|| (t)||dt
(local) minimum of the weighted length L.
local geodesic (not minimal path).
Weight W(x) Curve

6. Curve Evolution
5
s
s+ds
Family of curves { s
(t)}s>0
minimizing E(
s
).
Do not confound:
t: abscise along the curve.
s: artiﬁcial “time” of evolution.

7. Curve Evolution
5
s
s+ds
Family of curves { s
(t)}s>0
minimizing E(
s
).
Do not confound:
t: abscise along the curve.
s: artiﬁcial “time” of evolution.
Local minimum of: min E( )
Minimization ﬂow: d
ds s
= E(
s
)

8. Curve Evolution
5
s
s+ds
Family of curves { s
(t)}s>0
minimizing E(
s
).
Do not confound:
t: abscise along the curve.
s: artiﬁcial “time” of evolution.
Local minimum of: min E( )
Minimization ﬂow: d
ds s
= E(
s
)
Warning: the set of curves is not a vector space.
Inner product at : µ, ⇥⇥ =
1
0
µ(t), ⇥(t)⇥|| (t)||dt
Riemannian manifold of inﬁnite dimension.

9. Curve Evolution
5
s
s+ds
Family of curves { s
(t)}s>0
minimizing E(
s
).
Do not confound:
t: abscise along the curve.
s: artiﬁcial “time” of evolution.
Local minimum of: min E( )
Minimization ﬂow: d
ds s
= E(
s
)
Warning: the set of curves is not a vector space.
Inner product at : µ, ⇥⇥ =
1
0
µ(t), ⇥(t)⇥|| (t)||dt
Riemannian manifold of inﬁnite dimension.
Numerical implementation: (k+1) = (k) ⇥kE( (k))

10. Intrinsic Curve Evolutions
6
Intrinsic energy E: evolution along the normal
speed
d
ds
⇥s
(t) = (⇥s
(t), ns
(t), ⇤s
(t)) ns
(t)
normal
ns
(t) = s
(t)
|| s
(t)||
⇥s
(t) = ns
(t), s
(t)⇥
1
|| s
(t)||2
Normal:
Curvature:
s
ns
E( ) only depends on { (t) \ t [0, 1]}.

11. Mean Curvature Motion
7
(x, n, ⇥) = ⇥
Speed:
No data-ﬁdelity: E( ) =
1
0
|| (t)||dt
Curve-shortening ﬂow.
d
ds s
(t) = ⇥s
(t)ns
(t)
0
s
E( + ⇥) = E( ) +
1
0
(t)
|| (t)||
, ⇥ (t)⇥dt + O(||⇥||)
⌅E( ) : t ⇤⇥
1
|| (t)||
d
dt
(t)
|| (t)||
d
ds s
= E(
s
)
Mean-curvature motion:

12. Discretization
8
Discretization: = { (i)}N 1
i=0
R2, with (N) = (0).
k
⇥µ, ⇥⇤ =
i
⇥µ(i), ⇥(i)⇤|| (i) (i + 1)||

13. Discretization
8
Discretization: = { (i)}N 1
i=0
R2, with (N) = (0).
Discrete energy:
k
E( ) =
i
|| (i) (i + 1)||
⇥µ, ⇥⇤ =
i
⇥µ(i), ⇥(i)⇤|| (i) (i + 1)||

14. Discretization
8
Discretization: = { (i)}N 1
i=0
R2, with (N) = (0).
Discrete energy:
k+1
=
k ⇥k E(
k
)
E(
k
)
k
E( ) =
i
|| (i) (i + 1)||
⇥µ, ⇥⇤ =
i
⇥µ(i), ⇥(i)⇤|| (i) (i + 1)||

15. Discretization
8
Discretization: = { (i)}N 1
i=0
R2, with (N) = (0).
Discrete energy:
k+1
=
k ⇥k E(
k
)
E(
k
)
k
⇥E( ) =
1
||⇥ ||
⇥ N ⇥( )
E( ) =
i
|| (i) (i + 1)||
⇥µ, ⇥⇤ =
i
⇥µ(i), ⇥(i)⇤|| (i) (i + 1)||
(⇥ )(i) = (i + 1) (i)
(⇥ )(i) = (i 1) (i)
(N )(i) =
(i)
|| (i)||

16. Geodesic Active Contours Motion
E( ) = L( ) =
1
0
W( (t))|| (t)||dt
(x, n, ⇥) = W(x)⇥ W(x), n
d
ds
⇥s
(t) = (⇥s
(t), ns
(t), ⇤s
(t)) ns
(t)
Weighted length:
Evolution:
0
s
Weight W(x)
where W is small.
ﬁnite di erences discretization.
attraction toward areas

17. Open vs. Closed Curves
s
0
Weight W(x) Image f(x)
x0
x1
0
s

18. Global Minimum with Fast Marching
Image f Metric W(x)
Distance Ux0
(x) Geodesic curve (t)
Geodesic distance map:
Global minimum: Ux0
(x1
) = L( )
Ux0
(x1
) = min
(0)=x0, (1)=x1
L( )

19. Global Minimum with Fast Marching
Image f Metric W(x)
Distance Ux0
(x) Geodesic curve (t)
Geodesic distance map:
Global minimum: Ux0
(x1
) = L( )
Ux0
(x1
) = min
(0)=x0, (1)=x1
L( )
– Compute Ux0
with Fast Marching.
– Solve EDO:
d
dt
(t) = Ux0
( (t))
(0) = x1
Fast O(N log(N)) algorithm:

20. Overview
• Parametric Edge-based Active Contours
•Implicit Edge-based Active
Contours
• Region-based Active Contor
12

21. Level Sets
{ s
(t) \ t [0, 1]} = x R2 \ ⇥s
(x) = 0 .
Level-set curve representation:
s
(x) = ||x x0
|| s
s
(x) = ||x x0
|| s
s
(x) 0
s
(x) 0

22. Level Sets
{ s
(t) \ t [0, 1]} = x R2 \ ⇥s
(x) = 0 .
Level-set curve representation:
s
(x) = ||x x0
|| s
s
(x) = ||x x0
|| s
s
(x) 0
s
(x) 0
Union of domains:
s
= min( 1
s
, 2
s
)
Intersection of domains:
s
= max( 1
s
, 2
s
)
s
= min( 1
s
, 2
s
)
s
(x) 0

23. Level Sets
{ s
(t) \ t [0, 1]} = x R2 \ ⇥s
(x) = 0 .
Level-set curve representation:
s
(x) = ||x x0
|| s
s
(x) = ||x x0
|| s
s
(x) 0
s
(x) 0
Union of domains:
s
= min( 1
s
, 2
s
)
Intersection of domains:
s
= max( 1
s
, 2
s
)
Popular choice: (signed) distance to a curve
⇥s
(x) = ± min
t
|| s
(t) x||
inﬁnite number of mappings
s s
.
s
= min( 1
s
, 2
s
)
s
(x) 0

24. Level Sets Evolution
14
Dictionary parameteric implicit:
ns
(t) = s
(x)
|| s
(x)||
Normal:
Position: x =
s
(t)
s
(x) = div ⇥s
|| ⇥s
||
(x)
Curvature:

25. Level Sets Evolution
14
Dictionary parameteric implicit:
ns
(t) = s
(x)
|| s
(x)||
Normal:
Position: x =
s
(t)
s
(x) = div ⇥s
|| ⇥s
||
(x)
Curvature:
d
ds
⇥s
(x) = || ⇥s
(x)|| ⇥s
(x),
⇥s
(x)
|| ⇥s
(x)||
, div ⇥s
|| ⇥s
||
(x) .
d
ds
⇥s
(t) = (⇥s
(t), ns
(t), ⇤s
(t)) ns
(t)
Evolution PDE:
All level sets evolves together.

26. Proof
15
t, ⇥s
(
s
(t)) = 0
Deﬁnition of level-sets:
d
ds
⇥s
(t) = (⇥s
(t), ns
(t), ⇤s
(t)) ns
(t)
Evolution PDE: ( )

27. Proof
15
t, ⇥s
(
s
(t)) = 0
⇥s
(x),
⇤ s
⇤s
(t) + ⇤⇥s
⇤s
(x) = 0 for x =
s
(t)
Deriving with respect to t:
Deﬁnition of level-sets:
d
ds
⇥s
(t) = (⇥s
(t), ns
(t), ⇤s
(t)) ns
(t)
Evolution PDE: ( )
( )

28. Proof
15
t, ⇥s
(
s
(t)) = 0
⇥s
(x),
⇤ s
⇤s
(t) + ⇤⇥s
⇤s
(x) = 0 for x =
s
(t)
Deriving with respect to t:
Deﬁnition of level-sets:
d
ds
⇥s
(t) = (⇥s
(t), ns
(t), ⇤s
(t)) ns
(t)
Evolution PDE: ( )
( )
( ) + ( ) : ⌅⇤s
⌅s
(x) = (x, ns
(t), ⇥s
(t)) ⇤s
(x), ns
(t)

29. Proof
15
t, ⇥s
(
s
(t)) = 0
⇥s
(x),
⇤ s
⇤s
(t) + ⇤⇥s
⇤s
(x) = 0 for x =
s
(t)
Deriving with respect to t:
Deﬁnition of level-sets:
d
ds
⇥s
(t) = (⇥s
(t), ns
(t), ⇤s
(t)) ns
(t)
Evolution PDE: ( )
( )
( ) + ( ) : ⌅⇤s
⌅s
(x) = (x, ns
(t), ⇥s
(t)) ⇤s
(x), ns
(t)
d
ds
⇥s
(x) = || ⇥s
(x)|| ⇥s
(x),
⇥s
(x)
|| ⇥s
(x)||
, div ⇥s
|| ⇥s
||
(x) .
For all x on the curve,
= s
(x)
|| s
(x)||

30. Implicit Geodesic Active Contours
16
d
ds s
= || s
||div W s
|| s
||
.
Evolution PDE:
Comparison with explicit active contours:
: 2D instead of 1D equation.
+ : allows topology change.

31. Implicit Geodesic Active Contours
16
Re-initialization: ⇥s
(x) = ± min
t
|| s
(t) x||
Eikonal equation: || s
|| = 1 with ⇥s
(
s
(t)) = 0
d
ds s
= || s
||div W s
|| s
||
.
Evolution PDE:
Comparison with explicit active contours:
: 2D instead of 1D equation.
+ : allows topology change.

32. Multiple Fluids Dynamics
17
See Ron Fedkiw homepage.
Multiple gaz:
Fluid/air interface:
http://physbam.stanford.edu/ fedkiw/

33. Overview
• Parametric Edge-based Active Contours
• Implicit Edge-based Active Contours
•Region-based Active Contours
18

34. Energy Depending on Region
19
Regularization
Data
ﬁdelity
Optimal segmentation [0, 1]2 = c:
min L1
( ) + L2
( c) + R( ) R( ) = | |
Chan-Vese binary model:
More general models
L1
( ) = |I(x) c1
|2dx

35. Energy Depending on Region
19
Regularization
Data
ﬁdelity
Optimal segmentation [0, 1]2 = c:
min L1
( ) + L2
( c) + R( ) R( ) = | |
Chan-Vese binary model:
More general models
Level set implementation: = {x \ (x) > 0}
Smoothed Heaviside:
H(x)
x
H (x) =
2
atan x

R( ) R( ) = ||⇥(H )(x)||dx
L1
( ) = |I(x) c1
|2dx
L1
( ) ⇥ L( ) = H ( (x))||I(x) c1
||2dx

36. Descent Schemes
20
For a given c = (c1, c2
) R2:
min

Ec
( ) = H ( (x))||I(x) c1
||2+
H ( ⇥(x))||I(x) c2
||2 + ||⇥(H ⇥)(x)||dx

37. Descent Schemes
20
Descent with respect to :
For a given c = (c1, c2
) R2:
⇥(k+1) = ⇥(k)
k Ec
(⇥(k))
G(x) = ||I(x) c1
||2 ||I(x) c2
||2
Ec
( ) = H ( (x))G(x)
div
⇥⇥
||⇥⇥||
(x)
min

Ec
( ) = H ( (x))||I(x) c1
||2+
H ( ⇥(x))||I(x) c2
||2 + ||⇥(H ⇥)(x)||dx

38. Descent Schemes
20
Descent with respect to :
For a given c = (c1, c2
) R2:
⇥(k+1) = ⇥(k)
k Ec
(⇥(k))
G(x) = ||I(x) c1
||2 ||I(x) c2
||2
Limit 0:
Ec
( ) = H ( (x))G(x)
div
⇥⇥
||⇥⇥||
(x)
⇥Ec
(⇥)
{ =0}
(x)||⇥⇥(x)||G(x)
Numerically, use Ec
( ) = || (x)||G(x)
min

Ec
( ) = H ( (x))||I(x) c1
||2+
H ( ⇥(x))||I(x) c2
||2 + ||⇥(H ⇥)(x)||dx

39. Update of c
21
Joint minimization: min
,c1,c2
Ec
( )

40. Update of c
21
Joint minimization: min
,c1,c2
Ec
( )
Update of : ⇥(k+1) = ⇥(k)
k Ec(k)
(⇥(k))

41. Update of c
21
Update of (c1, c2
):
c( ) =
I(x)H( (x))dx
H( (x))dx
Joint minimization:
c(k+1)
1
= c( (k))
c(k+1)
2
= c( (k))
min
,c1,c2
Ec
( )
Update of : ⇥(k+1) = ⇥(k)
k Ec(k)
(⇥(k))
(c(k+1)
1
, c(k+1)
2
) = argmin
c1,c2
Ec
( (k))

42. Example of Evolution
22
(0)
Use de-localized initialization.

43. Conclusion
23
Curve evolution
Energy minimization
Parametric vs. level set representation.
Dictionary to translate
– curve properties.