You are on page 1of 35

Gradient Vector Flow: A New

External Force for Snakes

Joseph 2006/09/13
Outline
 Introduction
 Background (Active Contour Model)
 Gradient Vector Flow Field
 GVF Fields and GVF Snakes
 Conclusion
Introduction
 Snakes, or active contours, are used extensively in
computer vision and image processing applications,
particularly to locate object boundaries.

 There are two general types of active contour models in


the literature today: parametric active contours and
geometric active contours .

 In this paper, we focus on parametric active contours,


which synthesize parametric curves within an image
domain and allow them to move toward desired features,
usually edges.
Introduction
 The internal and external forces are defined so that the
snake will conform to an object boundary or other
desired features within an image.

 Typically, the curves are drawn toward the edges by


potential forces.
 Additional forces, such as pressure forces, together with
the potential forces comprise the external forces.

 There are also internal forces designed to hold the curve


together (elasticity forces) and to keep it from bending
too much (bending forces).
Introduction
 There are two key difficulties with active contour
algorithms.
 First, the initial contour must, in general, be close to the true
boundary or else it will likely converge to the wrong result.
 Second, the active contours have difficulties progressing into
concave boundary regions .

 This paper develops a new external force for active


contours, largely solving both problems.
 This external force, which we call gradient vector flow
(GVF), is computed as a diffusion of the gradient vectors
of a gray-level or binary edge map derived from the
image.
Parametric Snake Model
Parametric Snake Model
 A traditional snake is a curve X ( s )  [ x( s ), y ( s)], s  [0,1] ,
that moves through the spatial domain of an image to
minimize the energy functional.

 where  and  are weighting parameters that control the


snake's tension and rigidity
Parametric Snake Model
 The external energy function Eext is derived from the
image so that it takes on its smaller values at the
features of interest, such as boundaries.
 Given a gray-level image I ( x, y ) , G ( x, y ) is a two-dimensional

Gaussian function with standard deviation  and  is the
gradient operator.

 If the image is a line drawing (black on white)


Parametric Snake Model
 A snake that minimizes E must satisfy the Euler equation

 This can be viewed as a force balance equation

 where and

 The internal force discourages stretching and bending while


the external potential force pulls the snake towards the desired
image contour.
Parametric Snake Model
 To find a solution to (6), the snake is made dynamic by
treating x as function of time t as well as s — i.e. X ( s, t ) .

 A solution to (7) can be found by discretizing the equation and


solving the discrete system iteratively.
Internal Energy
 If the curve is represented by n points

vi  ( xi , yi ) i 1......n

dv d 2v
  vi  vi 1 ,  vi 1  2vi  vi 1
ds ds 2

n 2 2
Eint ernal    vi vi 1   vi 1  2vi  vi 1
i 1
External Energy

n 2 2
Eexternal   G
x ( xi , yi )
G
i 1
y ( xi , yi )
Parametric Snake Model
An example of the movement of a point, vi , in an active contour.
 

The point, vi’ , is the location of minimum energy due to a large


 

gradient at that point.


Parametric Snake Model
 The snake solutions shown in Figs. 1(a) and 1(b) both
satisfy the Euler equations (6) for their respective energy
model.
 In Fig. 1(a) shows a 64  64-pixel line-drawing of a U-
shaped object (shown in gray) having a boundary
concavity at the top.
 The potential force field where   1.0 pixel
is shown in Fig. 1(b).
Parametric Snake Model
Parametric Snake Model
Generalized Force Balance Equations
(g)
 The choice of F ext can have a profound impact on both
the implementation and the behavior of a snake.
 Broadly speaking, the external forces can be divided into
two classes: static and dynamic.
 Static forces are those that are computed from the image
data, and do not change as the snake progresses.
 The most general static vector field can be decomposed
into two components: an irrotational (curl-free)
component and a solenoidal (divergence-free)
component.
Gradient Vector Flow Field
 We define below a new static external force field
, which we call the gradient vector flow (GVF) field.
 To obtain the corresponding dynamic snake equation, we
replace the potential force with , yielding

 This equation is solved in similar fashion to the traditional


snake—i.e., by discretization and iterative solution.
Edge Map
 We begin by defining an edge map f ( x, y ) derived from
the image I ( x, y ) having the property that it is larger near
the image edges.

 where i  1, 2, 3, or 4.
 First, the gradient of an edge map f has vectors
pointing toward the edges, which are normal to the edges
at the edges.
 Second, these vectors generally have large magnitudes
only in the immediate vicinity of the edges.
 Third, in homogeneous regions, where I ( x, y ) is nearly
constant, f is nearly zero.
Gradient Vector Flow
 We define the gradient vector flow field to be the vector
field that minimizes the energy
functional

 When f is small, the energy is dominated by sum of


the squares of the partial derivatives of the vector field,
yielding a slowly varying field.
 On the other hand, when f is large, the second term
dominates the integrand, and is minimized by setting
V  f .
Gradient Vector Flow
 Using the calculus of variations , it can be shown that the
GVF field can be found by solving the following Euler
equations

 where  2 is the Laplacian operator


 We note that in a homogeneous region [where I ( x, y ) is
constant], the second term in each equation is zero
because the gradient of f ( x, y ) is zero.
Gradient Vector Flow
 Equations (13a) and (13b) can be solved by treating u
and v as functions of time and solving
 The equations are known as generalized diffusion
equations, and are known to arise in such diverse fields
as heat conduction, reactor physics, and fluid flow.

ut ( x, y, t )   2u ( x, y, t )  [u ( x, y, t )  f x ( x, y )]
 [ f x ( x, y ) 2  f y ( x, y ) 2 ]

vt ( x, y, t )   2 v( x, y, t )  [v( x, y, t )  f y ( x, y )]
 [ f x ( x, y ) 2  f y ( x, y ) 2 ]
Gradient Vector Flow

 Where

 Any digital image gradient operator can be used to calculate fx


and f y .
2
The coefficients b( x, y ) , c ( x, y ) , and c ( x, y ) , can then be
1

computed and fixed for the entire iterative process.


Gradient Vector Flow
 To set up the iterative solution, let the indices i , j , and n
correspond to x , y , and t , respectively, and let the spacing
between pixels be x and y the time step for each iteration t
be .
Gradient Vector Flow
 Substituting these approximations into (15) gives our iterative
solution to GVF as follows:

 where ,
 Convergence can be made to be faster on coarser images—i.e.,
when x and y are larger.
 When  is large and the GVF is expected to be a smoother field,
the convergence rate will be slower (since t must be kept small).
GVF Fields and GVF Snakes
 In our first experiment, we computed the GVF field
for the line drawing of figure using .
 First, the GVF field has a much larger capture
range.
 A second observation is that the GVF vectors are
pointing somewhat downward into the top of the U-
shape, which should cause an active contour to
move farther into this concave region.
Convergence to a Concave Region

Fig. 3. (a) Convergence of a snake using (b) GVF external forces,


and (c) shown close-up within the boundary concavity.
Convergence to a Concave
Region

traditional potential forces GVF external forces


Convergence to a Concave
Region

Convergence of a snake using Convergence of a snake using


traditional potential forces GVF external forces
Streamlines of external force fields

Stream lines of particles in (a) a potential force field and (b) a GVF field.
Snake Initialization
Snake Initialization
Gray-level Images
 To compute GVF for gray-level images, the edge-map
function f ( x, y ) must first be calculated.
 Two possible choices for the edge-map are f 1 ( x, y )  I ( x, y )
or f 2 ( x, y )  (G ( x, y )  I ( x, y )) .
Gray-level Images

(a) A magnetic resonance


image of the left ventrical
of a human heart (short-
axis section).
(b) The edge map
with .
(c) The computed GVF.
(d) Initial and intermediate
contours (gray curves)
and the final contour
(white curve) of the GVF
snake.
Conclusion
 We have introduced a new external force model for
snakes called gradient vector flow (GVF).
 The field is calculated as a diffusion of the gradient
vectors of a gray-level or binary edge map.
 We have shown that it allows for flexible initialization
of the snake and encourages convergence to
boundary concavities.
 Finally, the GVF framework might be useful in
defining new connections between parametric and
geometric snakes, and might form the basis for a
new geometric snake.

You might also like