19
Snakes in Images Yan Xu Electrical &Computer Engineering Department Bio-Image Analytics Laboratory University of Houston

Snakes in Images (Active contour tutorial)

  • Upload
    yan-xu

  • View
    1.386

  • Download
    7

Embed Size (px)

Citation preview

Page 1: Snakes in Images (Active contour tutorial)

Snakes in Images

Yan Xu

Electrical &ComputerEngineering Department

Bio-Image Analytics Laboratory

University of Houston

Page 2: Snakes in Images (Active contour tutorial)

How snake works in images

http://www.iacl.ece.jhu.edu/~chenyang/research/levset/movie/index.html

Page 3: Snakes in Images (Active contour tutorial)

Step 1: Model the shape by curve or surface

Step 2: Define the energy function E along the curve

E = internal energy (curvature) + external energy (images)

Step 3: Derive the curve to minimize the energy (calculus of variations)

Step 4: Propagate the curves (gradient descent) to reach the minimum using level set (easier to implement in reality).

How snake works in images

Curve Energy Level set

Keywords:

Page 4: Snakes in Images (Active contour tutorial)

Consider a closed planar curve

The geometric trace of the curve can be alternatively represented implicitly as

Snake -> Curves( ) { ( ), ( )}, [0,1]C p x p y p p

}0),(|),{( yxyxC

0

0

1

1

C(0)

C(0.1)C(0.2)

C(0.4)

C(0.7)

C(0.95)

C(0.9)

C(0.8)

pC =tangent

ssC N

1

ssC N

C

| |

p

s

p

CC

CS(p) is the arclength

Page 5: Snakes in Images (Active contour tutorial)

Properties of level sets

The level set normal

Proof. Along the level sets (equal 0) we have zero change,

that is , but by the chain rule

So,

||N N

0s

Tyxyx sysxs

,),(

T

||||0,

||NTT

Page 6: Snakes in Images (Active contour tutorial)

Properties of Level Sets

The level set curvature

Proof. zero change along the level sets, , also

So,

=div| |

ssC

0ss

NTds

dT

ds

dyx

ds

dyx sysxss

,,,)(),(

, | | [ , ],| | | |

xx s xy s xy s yy sx y x y

Numerical Geometry of Images:http://webcourse.cs.technion.ac.il/236861/Winter2012-2013/en/ho_Tutorials.html

Page 7: Snakes in Images (Active contour tutorial)

Propagation of Curves

tC N

Curvature Flow

Gage-HamiltonGrayson

First becomesconvex

Vanish at aCircularpoint

Constant FlowtC N

Change in topology

Page 8: Snakes in Images (Active contour tutorial)

Curve propagation in Level Sets

dC d

V N Vdt dt

ttytx yxt

tyx );,(0

NVNVCyx ttytxt

,,,

C(t) level set 0

, ,x y t

x

y

y

x

C(t)

||N

||||

,, VVNV

Page 9: Snakes in Images (Active contour tutorial)

Curve propagation in Level Sets

Handles changes in topology

Numeric grid points never collide

or drift apart.

Parametric Curve -> Level set in plane -> add time axis for propagation

Page 10: Snakes in Images (Active contour tutorial)

Some flows

2 2

2 2

2 div

t t

xx y xy x y yy x

t t

x y

C VN V

C N

,2

div ,

22

22

gg

gNNggC

yx

xyyyxxyyxx

tt

Curve propagation in Level Sets

Page 11: Snakes in Images (Active contour tutorial)

Snake Model1

2 2

0

arg min 2 ( ) p ppC

C C g C dp

A snake that minimize E must satisfy the Euler equation

pp pppp

dCC C g C

dt

2( ) | [ ( )* ( )] |g C G C I C

0pp ppppC C g C

To find a solution

When C stabilizes and the term Ct vanishes, a solution is achieved.

Energy

tension rigidity external energy from the image

Snakes: Active Contour Models, 1988

Page 12: Snakes in Images (Active contour tutorial)

Geodesic Active Contour

yxgdt

d,div

I(x)

x

g(x)

x

( ) ( ),tC g C n g C n n

0arg min

L C

C

g C ds

Euler Lagrange gradient descent

ds is the Euclidean arc-length.

Trying to find minimum weighted distance

Geodesic Active Contours, 1997

Page 13: Snakes in Images (Active contour tutorial)

GVF Snakes

Replace the external force with gradient vector flow (GVF) force v.

Why? f generally have large magnitudes only in the vicinity of the edges, the capture range would be small. It’s nearly zero in homogeneous regions.

V(x,y) = [u(x,y), v(x,y)] is defined as the vector field that minimizes the energy functional:

http://www.iacl.ece.jhu.edu/static/gvf/

pp pppp

dCC C g C

dt

V(x,y) = [u(x,y),v(x,y)]

Page 14: Snakes in Images (Active contour tutorial)

GVF Snake Results

2d GVF vector field

Original Snake Model

GVF Snake Model

Page 15: Snakes in Images (Active contour tutorial)

itk Implementation for GVF Geodesic Active Contour

Gradient MagnitudeSigmoid Rescaling

Original Image

Gradient Vector Flow

Initial Contour

Geodesic Active Contour

Thresholding

Gradient

Insight Segmentation and Registration Toolkit (ITK)

Page 16: Snakes in Images (Active contour tutorial)

gvfFilter->Update();

GeoAC->SetInput(initialContour->GetOutput());

GeoAC->SetAutoGenerateSpeedAdvection(false);

GeoAC->SetFeatureImage(sigmoid->GetOutput());

GeoAC->GenerateSpeedImage();

GeoAC->SetAdvectionImage(gvfFilter->GetOutput());

itk Implementation for GVF Geodesic Active Contour

Page 18: Snakes in Images (Active contour tutorial)

Calculus of Variations

Generalization of Calculus that seeks to find the path, curve, surface, etc., for which a given Functional has a minimum or maximum. Goal: find extrema values of integrals of the form

It has an extremum only if the Euler-LagrangeDifferential Equation is satisfied,

dxuuF x ),(

0),( x

x

uuFudx

d

u

Page 19: Snakes in Images (Active contour tutorial)

Calculus of Variations

Example: Find the shape of the curve {x,y(x)} with shortest length:

, given y(x0),y(x1)

Solution: a differential equation that y(x) must satisfy,

1

0

21

x

x

x dxy

baxxyayy

yx

x

xx )( 01

2/32

0x1x

)( 1xy)( 0xy