Mesh Processing Course : Active Contours

43
Active Contours Gabriel Peyré CEREMADE, Université Paris-Dauphine www.numerical-tours.com

description

Slides for a course on mesh processing.

Transcript of Mesh Processing Course : Active Contours

Page 1: Mesh Processing Course : Active Contours

Active Contours

Gabriel PeyréCEREMADE, Université Paris-Dauphine

www.numerical-tours.com

Page 2: Mesh Processing Course : Active Contours

Overview

•Parametric Edge-based Active Contours

• Implicit Edge-based Active Contours

• Region-based Active Contours

2

Page 3: Mesh Processing Course : Active Contours

Parametric Active Contours

3

– Closed curve: �(0) = �(1).– Open curve: �(0) = x0 and �(1) = x1.

Boundary conditions:

Local minimum: �� � argmin�

E(�) = L(�) + ⇥R(�)

RegularizationDatafidelity

x0

x1

Page 4: Mesh Processing Course : Active Contours

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

0W (�(t))||��(t)||dt,

Local minimum: �� � argmin�

E(�) = L(�) + ⇥R(�)

RegularizationDatafidelity

x0

x1

Image f Weight W (x) Curve ��

Page 5: Mesh Processing Course : Active Contours

Geodesic Active Contours

4

Geodesic active contours: (intrinsic) Replace W by W + �,

E(�) = L(�) =� 1

0W (�(t))||��(t)||dt

� (local) minimum of the weighted length L.

� local geodesic (not minimal path).

Weight W (x) Curve ��

Page 6: Mesh Processing Course : Active Contours

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: artificial “time” of evolution.

Page 7: Mesh Processing Course : Active Contours

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: artificial “time” of evolution.

Local minimum of: min�

E(�)

Minimization flow: d

ds�s = ��E(�s)

Page 8: Mesh Processing Course : Active Contours

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: artificial “time” of evolution.

Local minimum of: min�

E(�)

Minimization flow: 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 infinite dimension.

Page 9: Mesh Processing Course : Active Contours

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: artificial “time” of evolution.

Local minimum of: min�

E(�)

Minimization flow: 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 infinite dimension.

Numerical implementation: �(k+1) = �(k) � ⇥kE(�(k))

Page 10: Mesh Processing Course : Active Contours

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) = �n�s(t), ��

s(t)⇥1

||��s(t)||2

Normal:

Curvature:

�s

ns

E(�) only depends on {�(t) \ t � [0, 1]}.

Page 11: Mesh Processing Course : Active Contours

Mean Curvature Motion

7�(x, n, ⇥) = ⇥Speed:

No data-fidelity: E(�) =� 1

0||��(t)||dt

�� Curve-shortening flow.

d

ds�s(t) = ⇥s(t)ns(t)

�0

�s

E(� + ⇥) = E(�) +� 1

0� ��(t)||��(t)|| , ⇥�(t)⇥dt + O(||⇥||)

⌅E(�) : t ⇤⇥ � 1||�(t)||

ddt

���(t)

||��(t)||

d

ds�s = ��E(�s)

Mean-curvature motion:

Page 12: Mesh Processing Course : Active Contours

Discretization

8

Discretization: � = {�(i)}N�1i=0 � R2, with �(N) = �(0).

�k

⇥µ, ⇥⇤� =�

i⇥µ(i), ⇥(i)⇤||�(i) � �(i + 1)||

Page 13: Mesh Processing Course : Active Contours

Discretization

8

Discretization: � = {�(i)}N�1i=0 � R2, with �(N) = �(0).

Discrete energy:

�k

E(�) =�

i ||�(i)� �(i + 1)||

⇥µ, ⇥⇤� =�

i⇥µ(i), ⇥(i)⇤||�(i) � �(i + 1)||

Page 14: Mesh Processing Course : Active Contours

Discretization

8

Discretization: � = {�(i)}N�1i=0 � R2, with �(N) = �(0).

Gradient descent flow:

Discrete energy:

�k+1 = �k � ⇥k�E(�k)

��E(�k)

�k

E(�) =�

i ||�(i)� �(i + 1)||

⇥µ, ⇥⇤� =�

i⇥µ(i), ⇥(i)⇤||�(i) � �(i + 1)||

Page 15: Mesh Processing Course : Active Contours

Discretization

8

Discretization: � = {�(i)}N�1i=0 � R2, with �(N) = �(0).

Gradient descent flow:

Discrete energy:

�k+1 = �k � ⇥k�E(�k)

��E(�k)

�k

⇥E(�) =1

||⇥�||⇥� �N � ⇥(�)Discrete gradient:

E(�) =�

i ||�(i)� �(i + 1)||

⇥µ, ⇥⇤� =�

i⇥µ(i), ⇥(i)⇤||�(i) � �(i + 1)||

(⇥�)(i) = �(i + 1)� �(i)

(⇥��)(i) = �(i� 1)� �(i)

(N�)(i) =�(i)||�(i)||

Page 16: Mesh Processing Course : Active Contours

Geodesic Active Contours Motion

E(�) = L(�) =� 1

0W (�(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.

�� finite di�erences discretization.

�� attraction toward areas

Page 17: Mesh Processing Course : Active Contours

Open vs. Closed Curves

�s

�0

Weight W (x) Image f(x)

x0

x1

�0

�s

Page 18: Mesh Processing Course : Active Contours

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(�)

Page 19: Mesh Processing Course : Active Contours

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:

Page 20: Mesh Processing Course : Active Contours

Overview

• Parametric Edge-based Active Contours

•Implicit Edge-based Active Contours

• Region-based Active Contor

12

Page 21: Mesh Processing Course : Active Contours

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

Example: circle of radius r

Example: square of radius r

Page 22: Mesh Processing Course : Active Contours

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(�1s,�

2s)

Intersection of domains: �s = max(�1s,�

2s)

Example: circle of radius r

Example: square of radius r

�s = min(�1s,�

2s)

�s(x) � 0

Page 23: Mesh Processing Course : Active Contours

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(�1s,�

2s)

Intersection of domains: �s = max(�1s,�

2s)

Popular choice: (signed) distance to a curve

⇥s(x) = ± mint

||�s(t)� x||

Example: circle of radius r

Example: square of radius r

�� infinite number of mappings �s � �s.�s = min(�1

s,�2s)

�s(x) � 0

Page 24: Mesh Processing Course : Active Contours

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:

Page 25: Mesh Processing Course : Active Contours

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.

Page 26: Mesh Processing Course : Active Contours

Proof

15

� t, ⇥s(�s(t)) = 0Definition of level-sets:

d

ds⇥s(t) = �(⇥s(t), ns(t),⇤s(t)) ns(t)Evolution PDE: (�)

Page 27: Mesh Processing Course : Active Contours

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:

Definition of level-sets:

d

ds⇥s(t) = �(⇥s(t), ns(t),⇤s(t)) ns(t)Evolution PDE: (�)

(��)

Page 28: Mesh Processing Course : Active Contours

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:

Definition 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)�

Page 29: Mesh Processing Course : Active Contours

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:

Definition 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)||

Page 30: Mesh Processing Course : Active Contours

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.

Page 31: Mesh Processing Course : Active Contours

Implicit Geodesic Active Contours

16

Re-initialization: ⇥s(x) = ± mint

||�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.

Page 32: Mesh Processing Course : Active Contours

Multiple Fluids Dynamics

17

See Ron Fedkiw homepage.Multiple gaz:

Fluid/air interface:

http://physbam.stanford.edu/�fedkiw/

Page 33: Mesh Processing Course : Active Contours

Overview

• Parametric Edge-based Active Contours

• Implicit Edge-based Active Contours

•Region-based Active Contours

18

Page 34: Mesh Processing Course : Active Contours

Energy Depending on Region

19

RegularizationDatafidelity

Optimal segmentation [0, 1]2 = � � �c:

min�

L1(�) + L2(�c) + �R(�) R(�) = |��|

Chan-Vese binary model:

�� More general models

L1(�) =�

�|I(x)� c1|2dx

Page 35: Mesh Processing Course : Active Contours

Energy Depending on Region

19

RegularizationDatafidelity

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)

xH�(x) =

2�

atan�x

R(�) � R(�) =�

||⇥(H�)(x)||dx

L1(�) =�

�|I(x)� c1|2dx

L1(�) ⇥ L(�) =�

H�(�(x))||I(x)� c1||2dx

Page 36: Mesh Processing Course : Active Contours

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

Page 37: Mesh Processing Course : Active Contours

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

Page 38: Mesh Processing Course : Active Contours

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

Page 39: Mesh Processing Course : Active Contours

Update of c

21

Joint minimization: min�,c1,c2

Ec(�)

Page 40: Mesh Processing Course : Active Contours

Update of c

21

Joint minimization: min�,c1,c2

Ec(�)

Update of �: ⇥(k+1) = ⇥(k) � �k�Ec(k)(⇥(k))

Page 41: Mesh Processing Course : Active Contours

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 ) = argminc1,c2

Ec(�(k))

Page 42: Mesh Processing Course : Active Contours

Example of Evolution

22

�(0)

Use de-localized initialization.

Page 43: Mesh Processing Course : Active Contours

Conclusion

23

Curve evolution�� Energy minimization

Parametric vs. level set representation.

Dictionary to translate

– curve properties.– energy gradients.

Edge based vs. region based energies.