2) Active Contour Models (SNAKES)

advertisement
Active Contour Models
(Snakes)
Amyn A. Poonawala
amyn@cse.ucsc.edu
EE-264
Instructor: Dr. Peyman Milanfar
Section-1
(Traditional Snake Model)
1) Background:
Active contour models also known as snakes are being extensively used to solve the
problem of image segmentation. In this section we will try to understand why we need
active contours to perform this task in spite of the existing methods.
Image Segmentation:
Segmentation means subdividing or partitioning an image into its constituent regions or
objects. Segmentation of images is not an easy task because the nature of underlying
objects we want to detect vary drastically. To add to the problem images themselves may
vary qualitatively e.g. noise or sampling artifacts corrupt medical images severely affecting
their quality. Segmentation is the first step in image analysis and hence is an important part
of image recognition and understanding process. The accuracy of segmentation determines
the accuracy of automated analysis procedures used in computer vision.
Image segmentation methods can be categorized as follows:
 Edge-based approaches: They use edge detection operators such as Roberts,
Prewitt, Sobel, and Laplacian. Resulting regions may not be connected, hence
edges need to be joined.
 Region-based approaches: They are based on similarity of regional image data.
Some of the more widely used approaches in this category are:
- Thresholding, Clustering.
- Region growing
- Splitting and merging.
Segmentation forms a link between low-level processes that use a bottom-up or datadriven approach (where there are no assumptions about the information in the image), and
high-level processes that use a top-down approach (driven by models and hypotheses).
Segmentation can use either or both of these approaches. The models used in top down
approach can be obtained for example by exploring the information contained in large
collections of images.
Problem with common techniques for Image segmentation:
Common techniques for segmentation for e.g. the edge based approaches cant split the
image into its separate constituent objects because it does not use any kind of prior
knowledge. They only highlight the edges in an image and hence they don’t solve the
problem completely. Moreover presence of noise and sampling artifacts deteriorate the
performance and cause these techniques to either fail completely or require some kind of
post-processing step to remove invalid object boundaries in the segmentation results. The
other problem is that most of the classical edge detection techniques work by convolving
the image with horizontal and vertical filters and this leads to favoring detection of
rectilinear objects.
These problems have been overcome by other techniques such as generalized Hough
transform and template matching. But template matching needs exact priori knowledge of
the shape we want to detect in the image. This is a very strong assumption and not always
possible. Even Hough transform requires us to know the nature of shape we are looking for
in the image. We would like to weaken the condition further and look for any shape in the
image that is smooth and forms a closed contour. Active contour models allow us to set up
such general conditions and find image structures that satisfy this condition.
2) Active Contour Models (SNAKES):
Introduction:
Active contour models (also known as ‘Snakes’) were introduced first by Kass et al. (1987)
as a solution to the task of finding salient contours like edges and lines in digitized images.
In this section we will understand this original model known as traditional or classical
snake model. An active contour model represents an object boundary or some other salient
image feature (e.g. shape) as a parametric curve that is allowed to deform from some
arbitrary initial shape towards the desired final shape. The problem of finding this final
contour is cast as an energy minimization problem with the intention that the final contour
yields a local minimum of an associated energy functional (E). The energy functional (E)
of the contour is defined such that the energy of the contour attains a local minimum when
the contour is spatially aligned with the shape or object boundary of interest in the image.
The energy functional is thus based upon the spatial features of the images under
inspection that we want to detect.
Motivation:
Snakes promise a segmentation technique that does not bias the final shape detection
toward straight edges. They also perform the segmentation task without a known or
predetermined shape and this property make them very useful in a variety of applications.
Another motivation for the use of snakes is the ability of these models to fill in edges
where weak image gradients are present. Thus snakes can also detect incomplete
boundaries, something that was not possible with the previous approaches. To summarize,
the main motivation for snake usage comes from its ability to capture non-rectilinear
(curved) object boundaries and their robustness to weak and incomplete edges.
Mechanism and Framework:
The basic mechanism of snake consists of the user or a higher-level process initializing any
arbitrary shaped contour close to the object boundary or salient features of the image to be
detected. The algorithm proceeds and the snake starts deforming trying to minimize its
energy functional at every step. In the process it “shrinks-wrap” around the object
boundary or salient feature of the image and stops when it attains spatial local minima
which is the point where the contour perfectly wraps around the object of interest. A
program controlling a snake causes it to evolve so as to reduce its energy.
One can interpret the snake framework that the snakes represent a top-down, rather than a
bottom-up, approach to image segmentation problem. We have modeled the problem as a
physical system trying to achieve minimum rest state. The prior can be interpreted in terms
of the initialization of the contour close to the desired boundary, which is used as an input
to start the algorithm. Besides that in many cases a “feedback” is provided at intermediate
stages by the higher-level process or an interacting user to guide the contour to the desired
final result. This is one more way to think of prior.
3) Modeling the contour:
The contour is defined in the (x, y) plane of an image as a parametric curve, v(s)=(x(s),
y(s)), where s is a parameter which increases as we around the contour and is related to arc
length
Energy functional (E):
Having specified the contour as v(s), our model is defined as a sum of energy terms in the
continuous spatial domain. The energy terms can be categorized as follows
1) Internal Energy: Internal energy is a function of the contour v(s) itself and it
specifies the tension and smoothness of the curve. It therefore depends on the
internal properties of the snake.
2) External energy: It is derived from the image under inspection and it possesses
local minima at the edges or the object boundaries.
3) Constraint energy: Constraint energy acts on the contour only if we have some
sort of interactive interpretation and feedback provided by a user, automatic
attentional mechanism or a higher-level process.
The mathematical model using above energy terms is
Esnake  Eint  Eext  Econ
Building up the model:
The internal energy of the contour is further said to be composed of 2 terms, Elastic energy
and Bending energy.
Elastic energy ( Eelastic ): The contour is treated as an elastic rubber band giving it an
elastic potential energy. This energy consists of first order derivative of the contour and it
discourages stretching by introducing tension in the contour.
Eelastic 
where vs 
1
( s) | vs |2 ds

2s
dv( s )
ds
Adjusting the weight (s) allows us to control the elastic energy along different parts of the
contour. However for most applications it is assumed to be a constant  throughout the
curve. The energy term is minimized and becomes zero when the first derivative of the
contour becomes zero everywhere signifying that the contour of minimum elastic energy is
one that has collapsed to a point. Therefore a contour trying to minimize elastic energy
deforms by contracting itself (shrinking). We will study its action on the contour in more
detail in the section of elastic forces.
Bending Energy ( Ebending ): The snake is also considered to behave like a thin metal strip
in addition to it being considered as an elastic band. This is one more physical property
that we assign to our snake. We say that our contour should try to be a smooth curve or
straight line and avoid sharp corners. Therefore the snake is considered to possess bending
energy, which is given as the sum of squared curvatures of the snake.
Ebending 
where vss 
1
(s) | vss |2 ds

2s
d 2 v( s )
ds 2
The second order derivative discourages bending. Sharp corners or points of high curvature
are characterized as high frequencies and bending energy is more sensitive (very high) for
contours having such sharp corners because the second order derivative will be very high
for such contours. Setting (s) to 0 at a point means that we are relaxing our condition and
allowing that point to develop a corner.
Adjusting the weights (s) and (s) controls the relative importance of the elastic and
bending energy terms and therefore the internal energy of the contours. We consider them
to be simply constants  and  for our purpose which means they have the same value all
around the contour. The first term of our energy model can now be written as
1
Eint  Eelastic  Ebending    | vs |2  | vss |2 )ds
2
s
External energy ( Eext ): External energy is derived from the image that contains our
object of interest.
We define a continuous function Eimage ( x, y ) so that it takes on its smaller values at the
features of interest, such as boundaries. External image energy of the whole contour ( Eext )
is then defined as
Eext   Eimage (v( s))ds
s
Therefore the key is in defining a suitable Eimage . Suppose we want the snake to latch to
bright structures in the image. Then Eimage can be defined simply as Eimage = –I(x,y) where
I(x,y) refers to the gray level intensity values of the image. Reducing such an energy
function (i.e. making it more negative) will move the snake towards brighter parts of the
image.
The other ways to define Eimage which push active contour towards edges are as follows:
Eimage ( x, y)   |  x, y)|2
Eimage ( x, y)   | (G ( x, y) * I ( x, y)) |2
If the object we are looking for is made up of black lines on an image having a white
background, then the appropriate external energies include
Eimage ( x, y )  I ( x, y )
Eimage ( x, y )  G ( x, y ) * I ( x, y )
 x, y ) denotes the gradient of the image and G ( x, y ) is a two-dimensional Gaussian
function with standard deviation . It can be seen that larger  will increase the blurring of
the edges thereby increasing the capture range of the active contour.
Constraint energy (Econ): The constraint energy is determined by the additional
constraints set by the user on the snake. The model given by Kass proposed that snakes be
used as a power assisted tool for the user to detect objects in an image. In this case the user
provides a feedback to the system that is incorporated in the form of constraint energy.
One way of doing this is to allow the user to connect a spring between any point x1 in the
spatial domain and a point x2 on the snake. A snake trying to reduce its constraint energy is
pulled towards the point x1 defined by the user. Constraint energy can also be interpreted
as a kind of prior for the system. With reference to my project I am not allowing the user to
set any external constraints for the contour.
4) Euler equation for the model:
With the energy terms defined for our proposed model we can now formulate our problem
as that of finding a curve v*(s) so that the energy functional Esnake attains a minima where
1
Esnake   (s) | vs |2 ( s) | vss |2 )  Eimage (v( s))ds
2
s
Finding a curve for which E has a stationary value is a problem of variational calculus and
we can apply the fundamental equation known as Euler-Lagrange Differential Equations to
our system giving the following equation
vss  vssss  Eimage  0
Solution of the above equation gives us our final contour minimizing Esnake .
Let us try to interpret the terms of the above equation. One way to interpret this equation is
to consider it to be a force balance equation of a system
Fint  Fext  0
where Fint  vss  vssss and Fext  Eimage
The internal forces discourage stretching and bending while the external force pulls the
snake towards the desired image edges. Therefore when the original contour evolves and
deforms into the final contour Fint = -Fext which means that for every point along the curve
the internal and external forces are equal and act in opposite direction to each other giving
a stable state.
5) Forces acting on the contour:
Elastic force:
Elastic force is generated due to elastic potential energy present in the contour. It is given
as Felastic  vss . The elastic force at any point in the curve is oriented in the direction of
center of curvature at each point on the contour. This causes the contour at these points to
expand until the concavity is eliminated. The other action of elastic forces is to shrink the
curve and it is responsible to collapsing the contour to a single point in the absence of any
opposing force. The figure below shows the action of elastic force on the curve. The initial
contour was allowed to deform freely under the influence of only elastic force. Notice how
the concavities are eliminated and the entire curve is shrinking. If we would allow the
curve to move freely for few more iteration, it will eventually collapse to a point.
The elastic forces also tend to evenly space the control points along the contour making it
evenly sampled because a point at equal distance from its neighbors will experience least
elastic force due to balancing of the opposite forces from its neighbors. In fact if the 3
points are collinear and equally spaced the force equals to 0.
Bending Force:
Bending force acts on the curve due to the bending energy of the contour and is given by
Fbending  vssss . Bending force is strong at corners i.e. points with very high curvature and
it tries to eliminate these sharp corners thereby smoothing the contour.
Initial curve
Final curve
The above figure helps understand the action of bending force. The initial curve was
allowed to deform only under the influence of bending force giving the final curve. Notice
how all the corners were smooth out thereby reducing the bending energy of the contour,
and this is exactly what bending force should be doing. If we continue this for more
iterations the bending force will eventually seek to make the curve into circle because a
circle has lowest bending energy.
External Force:
The external force is generated due to the potential external energy which we have given to
the system. The force seeks to minimize Eext It is given as
Fext  Eimage
Image
External force
Zoomed in
As seen from the above figure the external force acting on points near the boundary tries to
pull the points towards the boundary.
6) Discretization and Implementation of Active Contour Model:
The first step towards solving the problem of image segmentation using our model is to
discretize the contour. In the discrete model, the contour v(s) is represented by a set of
control points v0 , v1 ,....., vn1 which are said to be connected by straight lines giving a piecewise linear curve. Each control point has a position, given by (X, Y) co-ordinates in the
image, and a snake is entirely specified by number and co-ordinates of control points. The
adjustment of the snake (deformation) is obtained by moving the control points
individually. The energy terms, forces etc are all converted to the discrete form with the
derivatives substituted by finite differences and the integrals substituted by the
summations. The forces acting along the contour are now calculated at each of these
control points separately and the entire curve is declared to achieve a minima when each of
these control points attains local minima.
Finite difference equations for energy and forces:
Elastic energy and force: The elastic energy causes the control points to be connected to
each other by springs in tension. The springs are assumed to have 0 resting length and
hence energy is proportional to the distance of separation between adjacent control points.
The potential energy of a spring stretched by a distance d having spring constant  is given
by 1 x 2 . Therefore potential energy of our entire contour is given as
2
 n
 (Distance between control points i and i+1) 2 = 12   | vs |2 ds
2 i1
s
where control point i+1 is same as i because we assume the contour is closed.
Eelastic 
Each control point experiences pull from its two nearest neighbors given by the Hookes
law (F = -d) and the total force acting on each control point is sum of these.
d 2 x( s )
Felastic _ x (i )  
  x(i  1)  x(i  1)  2 x(i ))
ds 2
d 2 y (s)
Felastic _ y (i)  
  y (i  1)  y (i  1)  2 y(i))
ds 2
Bending energy and force: Similar finite differences can also be applied to bending
energy and force equations to obtain the following
 n
1
Ebending   (v(i  1)  v(i  1)  2v(i)) 2    | vss |2 ds
2 i 1
2s
And the terms involving bending forces use 4th order derivatives which can be
approximated as

d 4 x( s )
 ( x(i  2)  4 x(i  1)  6 x(i )  4 x(i  1)  x(i  2))
ds 4

d 4 y(s)
 ( y (i  2)  4 y (i  1)  6 y (i )  4 y (i  1)  y (i  2))
dy 4
External energy and force: The gradient of an image I(x,y) is approximated as
I(x,y)=|Gx|+|Gy| where Gx and G y can be obtained by convolving the image with Sobelx
and Sobely or Prewitts filter. Also the force is given by using the central finite difference
operation.
Eimage _ x  Eimage ( x(i )  1, y (i))  Eimage ( x(i)  1, y (i))
Eimage _ y  Eimage ( x(i ), y (i )  1)  Eimage ( x(i), y (i)  1)
Numerical solution of Euler equation:
The final contour is the one that satisfies the force equation given as
vss  vssss  Eimage  0
We cannot solve the euler equation analytically because Eimage(x,y) changes with (x,y) and
so does Fimage_x and Fimage_y. Hence we have to use a numeric iterative approach.
Method 1:
The first method employed to solve the Euler equation is very simple to multiply the
external force by a constant  to bring the order of forces comparable to internal forces.
Alternatively we could normalize the external forces, but  gives us more control on Fext .
vss  vssss  Eimage  0
We use the formulas discussed in the previous section to calculate individual force terms
for each control point of the contour. We then apply the Euler equation iteratively giving
each control point a displacement (push) in the X and Y direction proportional to the sum
of forces acting on it. In physical system this is equivalent to dissipating some energy of
the system due to friction. After certain number of iterations we will converge to the final
contour and convergence is guaranteed. But the problem with this method is that we should
have a very small step size for each iteration and we don’t know how many iteration we
need to converge to the result. It is a very simple method and works well. However since
we don’t have any stopping condition it is not the smartest methods and user has to specify
the number of iterations to run. Much of research is being done to find better methods to
solve the equation and hence converge the snake faster.
Method 2:
Another way to find solution of the force equation is that the snake is made dynamic by
treating v as a function time t as well as s. Hence the contour is now defined as
v(s,t)=(x(s,t),y(s,t)) . Then the partial derivative of x with respect to time t is set equal to
the right hand side of Euler equation.
vss  s, t   vssss  s, t )  Eimage  vt ( s, t )
When v(s, t) stabilizes (i.e. reaches minima of E) the time derivative vanishes because the
forces cancel each other out at this point causing zero displacement for the points on the
contour. Hence we can declare that we have converged to the object boundary.
Algorithm:
1) For a control point ( x(i ), y (i )) of the contour find the internal forces acting on it.
2) Assuming that this control point moves under the influence of only its internal
force Fint , find the new position ( xnew, ynew) of the control point i. Obviously
( xnew, ynew) will have lower internal energy than ( x(i ), y (i )) .
3) Find the external energy Eimage(vnew) and Eimage(v(i)) and update v(i) to vnew only
if Eimage(vnew) is lower than Eimage(v(i)).
In other words we say that if the energy of control point at the estimated new
position is higher than current one, then we should not update because we have
reached a local minima.
4) Repeat the above steps for all control points until the time derivative on RHS
vanishes.
Consideration to overcome noise and false local minima:
Snakes are very highly sensitive to local minima. In fact if we simply apply the above
algorithm it miserably fails for noisy images and images having many weak and false local
minima. Noise pixels characterize many false local minima, which leads to our snake
getting stuck at these points. So we can do a simple tradeoff to improve performance.
Consider an image corrupted by white Gaussian noise. We apply a low pass filter to this
image to decrease the energy of noise pixels. In step 3 of the above algorithm, we calculate
the difference in energy level (E) between the 2 positions obtained from step 2 and
compare it to a threshold (K). If the difference is higher than the threshold, we declare we
have found a minima of the control point because of an edge and stop updating this control
point henceforth. If difference is below threshold then we conclude that the drop in energy
is due to noise or a weak edge and so we continue searching for other minima. K is set
proportional to the variance of the noise. The underlying assumption is that for pixel
belonging to a true edge, E will be higher than compared to pixels coming from noise or
weak edges. This setup requires that the object boundary of interest should be sharp.
7) Results:
Results were obtained using above explanation. Eimage was calculated using
Eimage ( x, y)   | (G ( x, y) * I ( x, y)) |2 which was scaled to have values between 0 and 255.
A)
The parameters of the snake were set to the following
=0.12; =0.01; =0.3; =0.1;
Sampling distance between control points for the user input curve =50.
Number of iterations performed to find final contour=400.
B)
The above image was corrupted by WGN with sigma=0.05. Using method 2 we are still
able to overcome the false local minima due to noise and detect the object of interest
(ellipse). The parameters for this snake were as follows.
=0.1; =0.01; =2 (2-D Gaussian Low pass filter);
Sampling distance between control points for the user input curve =22.
K=30;
8) Applications of snakes (Kass model):
Active contour models proposed by Kass find applications in variety of fields. Here I
discuss a few of them.
1) Image segmentation:
They have given a new way to solve the problem of image segmentation. Snakes have
become very popular especially in the medical imaging community where the problem
is more challenging due to poor quality images.
2) Motion tracking:
Snakes are being extensively used to track objects in real time. The idea is very simple.
The user initializes a contour in the first frame and we use our method to find the final
contour thus detecting the object of interest in the first frame. The initialization of the
contour for frame i+1 is done by using the final contour obtained from frame i by using
motion prediction. Thus we can achieve fast real time object tracking using this
method.
3) Stereo Matching:
The problem is to detect the projections of a 3-D object in 2 stereo images to facilitate
3-D reconstruction of the object. The idea is to couple the two snakes operating on the
two stereo images. This can be done by defining an additional energy functional which
acts as a constraint energy of the system.
4) Shape recognition:
Snakes can aid the process of object recognition, which is one of the important steps in
image understanding.
9) Weakness and limitations of traditional snake model:
The model proposed by Kass et al although gave a new approach to the process of image
segmentation and seems very promising has many weaknesses.
 Extremely sensitive to parameters:
As seen from the previous discussion we know that there are many different
parameters that we have to decide on.
These include the following:
 (Elastic force parameter)
 (Bending force parameter)
 (External force parameter)
 (Standard deviation of Gaussian filter)
Distance between control points while discretizing
The performance of our snake relies heavily on the proper assignment of these
parameters by the user or a high level process. Unfortunately these parameters
depend heavily on the underlying image and object of interest. The parameters have
to be decided by the user or a high level process after some test trials.
 Small capture range:
Image
External force field of the image
As seen from the above figures, the external force only acts in the immediate
vicinity of the boundary. Since the gradient of image is very low and essentially 0
for smooth areas, the external force acting on a control point in this region is 0.
Therefore snakes have a very small capture range and they should be initialized
close to the object boundary we want to detect. This is a very demanding condition.
Researchers proposed solution to this problem by applying a very high Gaussian
low pass filter to smooth out the edges, but by doing this we will have less accurate
results and loose out the concave regions completely.
 Fails to detect boundary concavities:
The snake model we studied fails to detect boundary concavities as seen from the
previous figure. The culprit once again is the external force. For example as seen
from the diagram below the external force acting on a control point in the concave
region simply pulls it in the horizontal direction. There is no force acting down
pulling a point further into the concave region towards the inner edge.
Traditional force field
Zoomed into the marked region
(Section-2)
Gradient Vector Flow (A new external force for snakes)
1) Introduction and motivation:
The traditional snake model given by Kass had many severe problems as discussed earlier
which decreased their effectiveness. Much of the reason for this poor performance was
attributed to the external force. Therefore in 1998, Chenyang Xu and Jerry Pince from John
Hopkins University proposed a new snake known as GVF snake. The basic model for GVF
snake was the same as traditional snake. However they defined a new external force field
known as Gradient vector flow field and hence the name GVF snake. GVF field was much
better than the external potential force field and overcame the deficiencies of the previous
model.
2) Model of GVF snake:
The GVF snake is defined as a contour v(s)=(x(s), y(s)) which satisfies the following Euler
equation
vss  vssss  V  0
Where V(x,y) = (u ( x, y ), v( x, y )) is the vector field which substitutes the external vector
force field Fext of the traditional snake. The internal forces are defined similar to the
original model consisting of elastic and bending forces. So lets see how is V(x,y) modeled.
We first define an edge map f(x,y) of the image. A few ways to define edge map of an
image are as follows,
f ( x, y) |  x, y)|2
f ( x, y ) | (G ( x, y ) * I ( x, y )) |2
V(x,y) is then defined to be a vector field which minimizes the following energy
functional.
E   (u x2  u y2  vx2  v y2 ) | f |2 | V  f |2 dxdy
where u x , u y , vx , v y are the partial derivatives of u ( x, y ) and v ( x, y ) in the x and y
directions. Consider the case when we are near the object boundary. We know that in this
case f will be very high. Therefore if we want to minimize E we set V=f. That’s exactly
what we want because we are happy with the effect f has on snake near the boundary.
Now consider the case when we are away from the boundary in a smooth region. In this
case f will be very small and the energy E can be minimized by minimizing the first term
made up of the partial derivatives. It turns out that minimizing this term gives a slowly
varying field in homogeneous region. The parameter  is used to control the relative
importance of the first and second term.
3) Euler equation for GVF field:
Finding a vector field which minimizes E is a variational calculus problem and it can be
solved by applying Euler-Lagrange differential equations. The equations obtained are
 u  (u  f x )( f x2  f y2 )  0
v  (v  f y )( f x2  f y2 )  0
Therefore our desired vector field V(x,y) is the one that satisfies the above Euler equations.
Lets have a look into Euler equations. In areas which are smooth, fx and fy are zeros and so
the vector field u(x,y) and v(x,y) is given by the first term. 2 is the Laplacian operator,
therefore the resulting vector field is obtained by diffusing the boundary vectors into
smooth areas using Laplacian equation. The greater the distance between a point and an
edge the lesser is the force acting on it due to diffusion. The resulting force is the sum of
these forces. This represents a competition between all the boundary vectors.
4) GVF force field:
GVF force field
Zoomed into concave region.
In the above figure notice that there is force acting in the concave region pulling a point
down towards the inner edge. This was not the case with traditional snake. Also note the
large capture range. In fact a GVF snake can even pull a snake initialized at the image
boundaries towards the object.
5) Implementation:
The Euler equation given can be solved iteratively. We can make the RHS equal to the
time derivative ut and vt. Therefore the Euler equations now become
 u ( x, y, t )  (u ( x, y, t )  f x ( x, y ))( f x ( x, y ) 2  f x ( x, y ) 2 )  ut ( x, y, t )
v( x, y, t )  (v( x, y, t )  f y ( x, y))( f x ( x, y) 2  f x ( x, y) 2 )  vt ( x, y, t )
The solution is found when the time derivatives become equal to 0. This acts like a
stopping condition.
Discretization:
To find the GVF field:
The u and v components of the GVF field were defined for each pixel of the image.
Therefore u(x,y) and v(x,y) were represented by 2 matrices of size equal to the image. The
above Euler equations were applied to each pixel in the image repeatedly. The parameter 
was taken from the user and was kept constant throughout the process. The Laplacian
operation is performed by applying the following mask.
The vector field finally obtained was normalized to have a unity magnitude.
The second step is to use the GVF force field obtained using above procedure to solve the
Euler equation for the snake.
vss  vssss  V  0
The method used to solve this equation is exactly similar to the one used to solve
traditional snakes. The solution to the above equation finds the contour that is our detected
boundary.
6) Results:
Here are a few results I obtained with my program. The GVF vector field obtained using
the above explanation was normalized so that all vectors have a magnitude equal to unity.
A) GVF force vector field components:
Image
u(x,y)
v(x,y)
u(x,y) gives the force acting on the points in the horizontal direction whereas v(x,y) gives
the force acting on the point in the vertical direction. Notice that the direction of these
orthogonal vector components is towards the edges in the concave region and even inside
the object and far away from the object.
B) GVF snake output:
One of the important things to take note of while implementing active contour models is to
reparametrize the curve dynamically to ensure that the distance between the control points
is same. To implement his I clustered the control points so that points very close to each
other are eliminated and then I resampled the control points at fixed equal distances. This
method seems more promising and worked well for most cases.
In the figure below, the snake was not able to detect the shape of the airplane completely
because it was not dynamically reparametrized. The position of the contour at various
iterations is also shown. It seems to have stuck up and does not go further inside. Also
notice that the airplane in the center is detected perfectly using clustering and
reparametrization to give us the final shape.
Without reparametrizing
With reparametrizing
The parameters of the snake were set to the following
=0.05; =0.00; =0.9; =0.2; =0.1;
Number of iterations done to find GVF field=300.
Number of iterations done to find final contour=300.
Distance between control points while reparametrizing=8
C) GVF snake can also be initialized across the object boundary:
The parameters of the snake were set to the following
=0.05; =0.01; =0.5; =0.2; =1.5;
Final conotur
Distance between control points while reparametrizing=8.
Number of iterations done to find GVF field=300.
Number of iterations done to find final contour=400.
D) GVF snakes also do a good job in detecting shapes in poor quality medical images:
The above is a magnetic resonance image of the left ventrical of a human heart. The
contour was initialized inside the object (small white circle) and it expanded under the
influence of GVF force field giving us more details of the borders. Here I also used
thresholding on the edge map of the image to kill values below 0.35 to 0. All values above
0.35 were left unaffected. This reduced the effect of sampling artifacts and gave better
results.
The parameters of the snake were set to the following
=0.045; =0.00; =0.8; =0.2; =1.5;
Distance between control points while reparametrizing=12.
Number of iterations done to find GVF field=200.
Number of iterations done to find final contour=500.
7) Drawbacks of GVF snakes:
Although the GVF snake seems very promising to us it still suffers from the following
drawbacks.

Sensitive to parameters: We have not been able to overcome this problem for
snakes. It persists for GVF snakes like it did for traditional snakes.

Speed: Solving the Euler equations to find the GVF field components is
computationally a very expensive process. Therefore it becomes almost
impossible for us to implement GVF in real time applications.
8) Conclusion:
Active contour models seem to be a promising and feasible approach to perform the task of
detecting arbitrary shapes in an image with a minimum prior. Their performance for
images corrupted by noise and poor sampling was also satisfying. Traditional models were
very easy to use in real time applications but they did not detect boundary concavities. On
the other hand GVF snakes were able to detect boundary concavities but too slow to
implement in real time.
References:
[1] M. Kass, A. Witkin, and D. Terzopoulos, "Snakes: Active contour models,”
International Journal of Computer Vision. v. 1, n. 4, pp. 321-331, 1987.
[2] C. Xu and J.L. Prince, “Gradient Vector Flow: A New External Force for Snakes,”
Proc. IEEE Conf. on Comp. Vis. Patt. Recog. (CVPR), Los Alamitos: Comp. Soc. Press,
pp. 66-71, June 1997.
[3] C. Xu and J.L. Prince, “Snakes, Shapes, and Gradient Vector Flow,” IEEE
Transactions on Image Processing, 359-369, March 1998.
[4] D.J. Williams, D.J. and M. Shah, “A fast algorithm for active contours.” CVGIP:
Image Understanding. v. 55, n. 1, pp. 14-26, 1990.
[5] Perrin, D. and Smith, C., “Rethinking classical internal forces for active contour
models”, to appear, The IEEE International Conference on Computer Vision and Pattern
Recognition, 2001.
[6] C. Xu and J. L. Prince, “Generalized Gradient Vector Flow External Forces for Active
Contours,” Signal Processing --- An International Journal, 71(2), pp. 131-139, December
1998
[7] C. Xu, D. L. Pham, and J. L. Prince, "Medical Image Segmentation Using Deformable
Models," SPIE Handbook on Medical Imaging -- Volume III: Medical Image Analysis,
edited by J.M. Fitzpatrick and M. Sonka, May 2000.
Download