Active contour model: Difference between revisions
Duncan.Hull (talk | contribs) |
Nolongernow (talk | contribs) *MAJOR* Reworded and moved around most sections and modified content that was likely plagiarism given the sources. Added sections about numerical instability. Added more information about alternative methods of Snakes. Added a few links to the bottom. |
||
Line 1: | Line 1: | ||
'''Active contour model''', also called '''snakes''', is a framework for delineating an object outline from a possibly [[image noise|noisy]] 2D [[image]]. |
'''Active contour model''', also called '''snakes''', is a framework in [[computer vision]] for delineating an object outline from a possibly [[image noise|noisy]] 2D [[image]]. The snakes model is popular in computer vision, and Snakes are greatly used in applications like object tracking, shape recognition, segmentation, edge detection, stereo matching. |
||
A snake is an energy minimizing, deformable [[Spline (mathematics)|spline]] influenced by constraint and image forces that pull it towards object contours and internal forces that resist deformation. Snakes may be understood as a special case of the general technique of matching a deformable model to an image by means of energy minimization.<ref>{{cite doi|10.1007/BF00133570|noedit}}</ref> In two dimensions, the [[active shape model]] represents a discrete version of this approach, taking advantage of the [[point distribution model]] to restrict the shape range to an explicit domain learned from a training set. |
|||
This framework attempts to [[graph cuts in computer vision|minimize an energy]] associated to the current contour as a sum of an internal and external energy: |
|||
[[File:Snake-contour-example.jpg|thumb|500px|Snakes – active deformable models]] |
|||
Snakes do not solve the entire problem of finding contours in images, since the method requires knowledge of the desired contour shape beforehand. Rather, they depend on other mechanisms such as interaction with a user, interaction with some higher level image understanding process, or information from image data adjacent in time or space. |
|||
*The ''external energy'' is supposed to be minimal when the snake is at the object boundary position. The most straightforward approach consists in giving low values when the regularized [[gradient]] around the contour position reaches its peak value. |
|||
*The ''internal energy'' is supposed to be minimal when the snake has a shape which is supposed to be relevant considering the [[shape]] of the sought object. The most straightforward approach grants high energy to elongated contours (elastic force) and to bended/high [[curvature]] contours (rigid force), considering the shape should be as regular and smooth as possible. |
|||
==Motivation== |
|||
The snakes model is popular in [[computer vision]], and led to several developments in 2D and 3D. In two dimensions, the [[active shape model]] represents a discrete version of this approach, taking advantage of the [[point distribution model]] to restrict the shape range to an explicit domain learned from a training set. |
|||
In computer vision, contour models describe the boundaries of shapes in an image. Snakes in particular is designed to solve problems where the approximate shape of the boundary is known. By being a deformable model, snakes can adapt to differences and noise in stereo matching and motion tracking. Additionally, the method can find [[Illusory contours]] in the image by ignoring missing boundary information. |
|||
[[File:Snake-contour-example.jpg|thumb|500px|Snakes – active deformable models]] |
|||
Compared to classical feature attraction techniques, Snakes have multiple advantages: |
|||
==Introduction== |
|||
* They autonomously and adaptively search for the minimum state. |
|||
* External image forces act upon the snake in an intuitive manner. |
|||
* Incorporating Gaussian smoothing in the image energy function introduces scale sensitivity. |
|||
* They can be used to track dynamic objects. |
|||
The key drawbacks of the traditional snakes are |
|||
Snake is an energy minimizing, deformable [[Spline (mathematics)|spline]] influenced by constraint and image forces that pull it towards object contours. Snakes are greatly used in applications like object tracking, shape recognition, segmentation, edge detection, stereo matching. Snakes may be understood as a special case of general technique of matching a deformable model to an image by means of energy minimization.<ref>{{cite doi|10.1007/BF00133570|noedit}}</ref> |
|||
Snake is an “active” model as it always minimizes its energy functional and therefore exhibits dynamic behavior. |
|||
* They are sensitive to local minima states, which can be counteracted by simulated annealing techniques. |
|||
A simple elastic snake is thus defined by |
|||
* Minute features are often ignored during energy minimization over the entire contour. |
|||
*a set of n points |
|||
* Their accuracy depends on the convergence policy. <ref>Snakes: an active model,Ramani Pichumani,http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/RAMANI1/node31.html</ref> |
|||
*an internal elastic energy term |
|||
*an external edge based energy term |
|||
One may visualize the snake as a rubber band of arbitrary shape that is deforming with time trying to get as close as possible to the object contour. Snakes do not solve the entire problem of finding contours in images, but rather, they depend on other mechanisms like interaction with a user, interaction with some higher level image understanding process, or information from image data adjacent in time or space. In general, Snake is placed near the object contour. It will dynamically move towards object contour by minimizing its energy iteratively. |
|||
==Energy |
== Energy Formulation == |
||
A simple elastic snake is defined by a set of ''n'' points <math> \mathbf v_i </math> where <math>i=0 \ldots n-1 </math>, the internal elastic energy term <math>E_{internal} </math>, and the external edge-based energy term <math>E_{external} </math>. The purpose of the internal energy term is to control the deformations made to the snake, and the purpose of the external energy term is to control the fitting of the contour onto the image. The external energy is usually a combination of the forces due to the image itself <math> E_{image} </math> and the constraint forces introduced by the user <math> E_{con}</math> |
|||
In Snakes, we use the technique of matching a deformable model to an image by means of energy minimization. A snake initialized near the target gets refined iteratively and is attracted towards the salient contour. A snake in the image can be represented as a set of ''n'' points. |
|||
The energy function of the snake is the sum of its external energy and internal energy, or |
|||
<math> \mathbf v_i=(x_i,y_i) </math> |
|||
:<math> E_{snake}^*=\int\limits_0^1E_{snake}(\mathbf{v}(s))\,ds=\int\limits_0^1 ( E_{internal}(\mathbf{v}(s))+E_{image}(\mathbf{v}(s))+E_{con}(\mathbf{v}(s)) )\,ds</math> |
|||
where <math>i=0 \ldots n-1 </math> |
|||
===Internal Energy=== |
|||
We can write its energy function as |
|||
The internal energy of the snake is comprised of the continuity of the contour <math> E_{cont} </math> and the smoothness of the contour <math> E_{curv} </math>. |
|||
<math> E_{snake}^*=\int\limits_0^1E_{snake}(\mathbf{v}(s))\,ds=\int\limits_0^1 ( E_{internal}(\mathbf{v}(s))+E_{image}(\mathbf{v}(s))+E_{con}(\mathbf{v}(s)) )\,ds</math> |
|||
:<math>E_{internal}=E_{cont}+E_{curv}</math> <ref>Dr. George Bebis,University of Nevada,http://www.cse.unr.edu/~bebis/CS791E/Notes/DeformableContours.pdf</ref> |
|||
<math>E_{external}=E_{image}+E_{con}</math> |
|||
This can be expanded as |
|||
where <math>E_{internal} </math> represents the internal energy of the spline (snake) due to bending, <math> E_{image} </math> denotes the image forces acting on spline and <math> E_{con} </math> serves as external constraint forces introduced by user. The combination of <math> E_{image} </math> and <math> E_{con} </math> can be represented as <math> E_{external} </math>, that denote the external energy acting on the spline. |
|||
:<math>E_{internal}=\frac{1}{2}(\alpha\,\!(s)\left | \mathbf{v}_s(s) \right \vert^2) + \frac{1}{2} (\beta\,\!(s)\left | \mathbf{v}_{ss}(s) \right \vert ^2) =\frac{1}{2} \bigg(\alpha\,\!(s) \left \| \frac{d\bar v}{ds}(s) \right \Vert^2 + \beta\,\!(s) \left \| \frac{d^2\bar v}{ds^2}(s) \right \Vert ^2 \bigg)</math> |
|||
===Internal energy=== |
|||
Where <math> \alpha (s) </math> and <math> \beta (s) </math> are user-defined weights; these control the internal energy function's sensitivity to the amount of stretch in the snake and the amount of curvature in the snake, respectively, and thereby control the number of constraints on the shape of the snake. |
|||
Internal Energy of the snake is |
|||
<math>E_{internal}=E_{cont}+E_{curv}</math> <ref>Dr. George Bebis,University of Nevada,http://www.cse.unr.edu/~bebis/CS791E/Notes/DeformableContours.pdf</ref> |
|||
In practice, a large weight <math> \alpha (s) </math> for the continuity term penalizes changes in distances between points in the contour. A large weight <math> \beta (s) </math> for the smoothness term penalizes oscillations in the contour and will cause the contour to act as a thin plate. |
|||
===Image Energy=== |
|||
<math>E_{internal}=(\alpha\,\!(s)\left | \mathbf{v}_s(s) \right \vert^2 + \beta\,\!(s)\left | \mathbf{v}_{ss}(s) \right \vert ^2)/2 </math> |
|||
<math>=\bigg(\alpha\,\!(s) \left \| \frac{d\bar v}{ds}(s) \right \Vert^2 + \beta\,\!(s) \left \| \frac{d^2\bar v}{ds^2}(s) \right \Vert ^2 \bigg) /2</math> |
|||
Energy in the image is some function of the features of the image. This is one of the most common points of modification in derivative methods. Features in images and images themselves can be processed in many and various ways. |
|||
The first-order term makes the snake act like a membrane and second-order term makes it act like a thin plate. Large values of <math> \alpha (s) </math> will increase the internal energy of the snake as it stretches more and more, whereas small values of <math> \alpha (s) </math> will make the energy function insensitive to the amount of stretch. Similarly, large values of <math> \beta (s) </math> will increase the internal energy of the snake as it develops more curves, whereas small values of <math> \beta (s) </math> will make the energy function insensitive to curves in the snake. Smaller values of both <math> \alpha (s) </math> and <math> \beta (s) </math> will place fewer constraints on the size and shape of the snake. |
|||
For an image <math> I(x,y) </math>, lines, edges, and terminations present in the image, the general formulation of energy due to the image is |
|||
===Image forces=== |
|||
:<math>E_{image}=w_{line}E_{line}+w_{edge}E_{edge}+w_{term}E_{term}</math>, |
|||
* Lines |
|||
* Edges |
|||
* Terminations |
|||
where <math>w_{line}</math>, <math>w_{edge}</math>, <math>w_{term}</math> are weights of these salient features. Higher weights indicate that the salient feature will have a larger contribution to the image force. |
|||
The energies can be represented as follows: |
|||
====Line Functional==== |
|||
<math>E_{image}=w_{line}E_{line}+w_{edge}E_{edge}+w_{term}E_{term}</math> |
|||
The line functional is the intensity of the image, which can be represented as |
|||
:<math>E_{line}= I(x,y)</math> |
|||
====Line functional==== |
|||
The sign of <math>w_{line}</math> will determine whether the line will be attracted to either dark lines or light lines. |
|||
A line functional is nothing but the intensity of the image, which can be represented as |
|||
Some smoothing or noise reduction may be used on the image, which then the line functional appears as |
|||
<math>E_{line}= I(x,y)</math> |
|||
:<math>E_{line}= filter (I(x,y))</math> |
|||
Depending on the sign of <math>w_{line}</math>, the line will be attracted to either dark lines or light lines. |
|||
====Edge |
====Edge Functional==== |
||
The edge functional is based on the image gradient. One implementation of this is |
|||
=====Image gradient===== |
|||
Edges in the image can be found by the following energy function which will make the snake attract towards contours with large image gradients. |
|||
<math>E_{edge}=-\left | \nabla I(x,y)\right \vert ^2</math> |
:<math>E_{edge}=-\left | \nabla I(x,y)\right \vert ^2</math> |
||
A snake originating far from the desired object contour may erroneously converge to some local minimum. Scale space continuation can be used in order to avoid these local minima. This is achieved by using a blur filter on the image and reducing the amount of blur as the calculation progresses to refine the fit of the snake. The energy functional using scale space continuation is |
|||
=====Scale space===== |
|||
:<math>E_{edge}=-\left | G_{\sigma} * \nabla ^2 I \right \vert ^2</math> |
|||
It is rather common that a snake started far from the object converges to the desired object contour. If a part of the snake finds a low energy feature, it pulls the other parts of the snake to continue to the contour. Scale Space continuation can be used in order to achieve desired results. One can allow the snake to come to equilibrium on a blurry energy edge functional and reduce the blurring as the calculation progresses. The energy functional is |
|||
where <math> G_{\sigma} </math> is a Gaussian with standard deviation <math> \sigma </math>. Minima of this function fall on the [[Zero crossing|zero-crossings]] of |
|||
<math>E_{edge}=-\left | G_{\sigma} * \nabla ^2 I \right \vert ^2</math> |
|||
<math> G_{\sigma} \nabla ^2 I </math> which define edges as per [[Marr-Hildreth algorithm|Marr-Hildreth]] Theory. |
|||
====Termination Functional==== |
|||
Where <math> G_{\sigma} </math> is a Gaussian standard deviation <math> \sigma </math> minima of this functional lie on [[Zero crossing|zero-crossings]] of |
|||
<math> G_{\sigma} \nabla ^2 I </math> which define edges in [[Marr-Hildreth algorithm|Marr-Hildreth]] Theory. Thus the snake gets attracted towards zero-crossing constrained by its own smoothness. |
|||
Curvature of level lines in a slightly smoothed image can be used to detect corners and terminations in an image. Using this method, let <math> C(x,y) </math> be the image smoothed by |
|||
====Termination functional==== |
|||
:<math> C(x,y)= G_{\sigma}*I(x,y) </math> |
|||
Curvature of level lines in a slightly smoothed image is used to detect corners and terminations in an image. Let <math> C(x,y)= G_{\sigma}*I(x,y) </math> be a slightly smoothed version of the image.Let <math> \theta = \arctan ( \frac {C_y}{C_x})</math> be the gradient angle. |
|||
with gradient angle |
|||
And let |
|||
<math> \mathbf n = (\cos \theta,\sin \theta)</math> and <math>\mathbf n_{\perp}= (-\sin \theta,\cos \theta) </math> be unit vectors along and perpendicular to the gradient direction. The termination functional of energy can be represented as |
|||
:<math> \theta = \arctan \Bigg ( \frac {C_y}{C_x} \Bigg )</math>, |
|||
<math> E_{term}={\partial \theta\over\partial n_{\perp}} = {\partial^2 C / \partial^2 n_{\perp} \over \partial C / \partial n} = {{C_{yy}C_x^2-2C_{xy}C_xC_y+C_{xx}C_y^2}\over(C_x^2+C_y^2)^{3/2}}</math> |
|||
unit vectors along the gradient direction |
|||
=== Constraint energy === |
|||
:<math> \mathbf n = (\cos \theta,\sin \theta)</math>, |
|||
and unit vectors perpendicular to the gradient direction |
|||
:<math>\mathbf n_{\perp}= (-\sin \theta,\cos \theta) </math>. |
|||
The termination functional of energy can be represented as |
|||
:<math> E_{term}={\partial \theta\over\partial n_{\perp}} = {\partial^2 C / \partial^2 n_{\perp} \over \partial C / \partial n} = {{C_{yy}C_x^2-2C_{xy}C_xC_y+C_{xx}C_y^2}\over(1+C_x^2+C_y^2)^{3/2}}</math> |
|||
=== Constraint Energy === |
|||
Some systems, including the original snakes implementation, allowed for user interaction to guide the snakes, not only in initial placement but also in their energy terms. Such constraint energy <math> E_{con} </math> can be used to interactively guide the snakes towards or away from particular features. |
Some systems, including the original snakes implementation, allowed for user interaction to guide the snakes, not only in initial placement but also in their energy terms. Such constraint energy <math> E_{con} </math> can be used to interactively guide the snakes towards or away from particular features. |
||
== Optimization Through Gradient-Descent Minimization == |
|||
Given an initial guess for a snake, the energy function of the snake is iteratively minimized. [[Gradient descent]] minimization is one of the simplest optimizations which can be used to minimize snake energy. <ref>Image Understanding,Bryan S. Morse,Brigham Young University,1998-2000 http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/MORSE/iu.pdf</ref> Each iteration takes one step in the negative gradient of the point with controlled step size <math> \gamma </math> to find local minima. This gradient-descent minimization can be implemented as |
|||
:<math>\bar v_i \leftarrow \bar v_i + F_{snake}(\bar v_i)</math> |
|||
Where <math> F_{snake}(\bar v_i) </math> is the force on the snake, which is defined by the negative of the gradient of the energy field. |
|||
:<math> F_{snake}(\bar v_i) = - \nabla E_{snake} (\bar v_i) = - \Bigg( w_{internal} \nabla E_{internal} (\bar v_i)+w_{external} \nabla E_{external} (\bar v_i) \Bigg) </math> |
|||
Assuming the weights <math> \alpha(s) </math> and <math> \beta(s) </math> are constant with respect to <math> s </math>, this iterative method can be simplified to |
|||
:<math>\bar v_i= \leftarrow \bar v_i - \gamma \Bigg\{ w_{internal} \bigg[ \alpha \frac{\partial ^2 \bar v}{\partial s^2} (\bar v_i)+\beta \frac{\partial ^4 \bar v}{\partial s^4} (\bar v_i) \bigg] + \nabla E_{ext} (\bar v_i) \Bigg\} </math> |
|||
==Discrete Approximation== |
|||
In practice, images have finite resolution and can only be integrated over finite time steps <math> \tau </math>. As such, discrete approximations must be made for practical implementation of snakes. |
|||
The energy function of the snake can be approximated by using the discrete points on the snake. |
|||
:<math>E_{snake}^*\approx \displaystyle \sum_1^n E_{snake}(\bar v_i)</math> |
|||
Consequentially, the forces of the snake can be approximated as |
|||
:<math>F_{snake}^*\approx -\displaystyle \sum_1^n \nabla E_{snake} (\bar v_i) </math> |
|||
Gradient approximation can be done through any finite approximation method with respect to ''s'', such as [[Finite difference]]. |
|||
===Numerical Instability Due to Discrete Time=== |
|||
The introduction of discrete time into the algorithm can introduce updates which the snake is moved past the minima it is attracted to; this further can cause oscillations around the minima or lead to a different minima being found. |
|||
This can be avoided through tuning the time step such that the step size is never greater than a pixel due to the image forces. However, in regions of low energy, the internal energies will dominate the update. |
|||
Alternatively, the image forces can be normalized for each step such that the image forces only update the snake by one pixel. This can be formulated as |
|||
:<math> F_{image} = - k \frac{\nabla E_{image}}{\|\nabla E_{image}\|} </math> |
|||
where <math> \tau k </math> is near the value of the pixel size. This avoids the problem of dominating internal energies that arise from tuning the time step.<ref name='balloon'>Laurent D. Cohen, On active contour models and balloons, CVGIP: Image Understanding, Volume 53, Issue 2, March 1991, Pages 211-218, ISSN 1049-9660, http://dx.doi.org/10.1016/1049-9660(91)90028-N. |
|||
(http://www.sciencedirect.com/science/article/pii/104996609190028N)</ref> |
|||
===Numerical Instability Due to Discrete Space=== |
|||
The energies in a discrete image may have zero-crossing that do not exist as a pixel in the image. In this case, a point in the snake would oscillate between the two pixels that neighbor this zero-crossing. This oscillation can be avoided by using interpolation between pixels instead of nearest neighbor.<ref name='balloon' /> |
|||
==Implementation== |
==Implementation== |
||
The following [[pseudocode]] implements the snakes method in a general form |
|||
Gradient-descent minimization <ref>Image Understanding,Bryan S. Morse,Brigham Young University,1998-2000 http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/MORSE/iu.pdf</ref> is one of the simple optimizations which can be used to minimize snake energy. For example, let’s consider a function of only one variable. If we have a starting guess at the value of the solution, we can look at the slope at that point and decide to increment our solution (negative slope) or decrement our solution (positive slope). Notice the negation there: if the slope is positive, downhill is backwards; and if the slope is negative, downhill is forwards. We can thus implement gradient-descent minimization as |
|||
<syntaxhighlight lang="matlab"> |
|||
<math>x_{t+1}=x_t+\gamma\frac{df}{dx}(x_t)</math> and |
|||
<math>y_{t+1}=y_t+\gamma\frac{df}{dy}(y_t)</math> |
|||
function v = snakes (I, v) |
|||
Where <math> \gamma </math> controls the size of the step at each iteration. |
|||
% INPUT: N by M image I, a contour v of n control points |
|||
% OUTPUT: converged contour v of n control points |
|||
E_image = generateImageEnergy (I); |
|||
Vector representation: <math>\bar x_{t+1}=\bar x_t+\gamma \nabla f(\bar x_t)</math> |
|||
while not converged |
|||
We can approximate the energy function of the snake by using the discrete points on the snake. |
|||
F_cont = weight.alpha * contourDerivative(v, 2); |
|||
F_curv = weight.beta * contourDerivative(v, 4); |
|||
F_image = interp2 (E_image, v(:,2), v(:,1); |
|||
F_image_norm = weight.k * F_image ./ norm (F_image); |
|||
F_con = inputForces(); |
|||
F_internal = F_cont + weight.external * F_curv; |
|||
<math>E_{snake}^*\approx \displaystyle \sum_1^n E_{snake}(\bar v_i)</math> |
|||
F_external = weight.external * (F_image + F_con); |
|||
v = updateSnake(v, F_internal, F_external); |
|||
The derivative of above sum is nothing but the sum of derivatives. |
|||
checkConvergence (); |
|||
<math>\nabla E_{snake}^*\approx \displaystyle \sum_1^n \nabla E_{snake} (\bar v_i) </math> |
|||
end |
|||
end |
|||
Now we should iteratively adjust the points vector <math> \mathbf v_i </math> by using gradient descent minimization. |
|||
</syntaxhighlight> |
|||
<math>\bar v_i \leftarrow \bar v_i-\nabla E_{snake}(\bar v_i)</math> |
|||
Where ''generateImageEnergy (I)'' can be written as |
|||
Applying the derivative to energy function gives |
|||
<syntaxhighlight lang="matlab"> |
|||
<math>\nabla E_{snake} (\bar v_i) = w_{internal} \nabla E_{internal} (\bar v_i)+w_{external} \nabla E_{external} (\bar v_i) </math> |
|||
function E_image = generateImageEnergy (I) |
|||
[C, Cx, Cy, Cxx, Cxy, Cyy] = generateGradients (I); |
|||
E_line = I; |
|||
Derivative of internal Energy of the image can be solved as |
|||
E_edge = -(Cx.^2 + Cy.^2)^0.5; |
|||
E_term = (Cyy.*Cx.^2 - 2*Cxy.*Cx.*Cy + Cxx.*Cy.^2)./((1 + Cx.^2 + Cy.^2).^(1.5)); |
|||
E_image = weight.line * E_line + weight.edge * E_edge + weight.term * E_term; |
|||
<math>\nabla E_{internal}(s)=\nabla \bigg[(\alpha\,\!(s)\left \| \mathbf{v}_s(s) \right \Vert^2 + \beta\,\!(s)\left \| \mathbf{v}_{ss}(s) \right \Vert ^2)/2 \bigg] </math> |
|||
end |
|||
</syntaxhighlight> |
|||
== Some Variants of Snakes == |
|||
<math>\nabla E_{internal} (s)= \Bigg[ \bigg(\alpha\,\!(s) \nabla \left \| \frac{d\bar v}{ds}(s) \right \Vert^2 + \beta\,\!(s) \nabla \left \| \frac{d^2\bar v}{ds^2}(s) \right \Vert ^2 \bigg) /2 \Bigg]</math> |
|||
<math>=\alpha \frac{\partial ^2 \bar v}{\partial s^2}+\beta \frac{\partial ^4 \bar v}{\partial s^4}</math> |
|||
The default method of snakes has various limitation and corner cases where the convergence performs poorly. Several alternatives exist which addresses issues of the default method, though with their own trade-offs. A few are listed here. |
|||
These can be approximated using [[finite difference]]s—the second derivative w.r.t. ''s'' can be calculated using three |
|||
adjacent points on the snake, and the fourth derivative w.r.t. ''s'' can be calculated using five adjacent points. It also helps |
|||
to separate the x and y components. |
|||
=== GVF Snake Model === |
|||
Final equations are |
|||
The Gradient Vector Flow (GVF) Snake Model<ref name="gvf">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, http://iacl.ece.jhu.edu/pubs/p087c.pdf</ref> addresses two issues with snakes: |
|||
<math>\bar v_i= \leftarrow \bar v_i - \gamma \Bigg\{ w_{internal} \bigg[ \alpha \frac{\partial ^2 \bar v}{\partial s^2} (\bar v_i)+\beta \frac{\partial ^4 \bar v}{\partial s^4} (\bar v_i) \bigg]</math> |
|||
<math>+ \nabla E_{ext} (\bar v_i) \Bigg\} </math> |
|||
*poor convergence performance for concave boundaries |
|||
<math>\bar x_i= \leftarrow x_i - \gamma \Bigg\{ w_{internal} \bigg[ \alpha \frac{\partial ^2 x}{\partial s^2} (\bar v_i)+\beta \frac{\partial ^4 x}{\partial s^4} (\bar v_i) \bigg]</math> |
|||
*poor convergence performance when snake is initialized far from minimum |
|||
<math>+ \frac{\partial}{\partial x} E_{ext} (\bar v_i) \Bigg\} </math> |
|||
In 2D, the GVF vector field <math> F_{GVF} </math> minimizes the energy functional |
|||
<math>\bar y_i= \leftarrow y_i - \gamma \Bigg\{ w_{internal} \bigg[ \alpha \frac{\partial ^2 y}{\partial s^2} (\bar v_i)+\beta \frac{\partial ^4 y}{\partial s^4} (\bar v_i) \bigg]</math> |
|||
<math>+ \frac{\partial}{\partial y} E_{ext} (\bar v_i) \Bigg\} </math> |
|||
:<math> E_{GVF} = \int \int \mu(u_x^2+u_y^2+v_x^2+v_y^2)+|\nabla f|^2|\mathbf v-\nabla f|^2 dx dy </math> |
|||
Where |
|||
where <math> \mu </math> is a controllable smoothing term. This can be solved by solving the Euler equations |
|||
<math> E_{external}=E_{image}+E_{con}</math> |
|||
:<math> \mu \nabla^2 u - \Bigg (u - \frac{\partial}{\partial x}F_{ext}\Bigg )\Bigg (\frac{\partial}{\partial x}F_{ext}(x,y)^2 + \frac{\partial}{\partial y}F_{ext}(x,y)^2\Bigg ) = 0 </math> |
|||
===Pseudo code=== |
|||
:<math> \mu \nabla^2 v - \Bigg (v - \frac{\partial}{\partial y}F_{ext}\Bigg )\Bigg (\frac{\partial}{\partial x}F_{ext}(x,y)^2 + \frac{\partial}{\partial y}F_{ext}(x,y)^2\Bigg ) = 0 </math> |
|||
# Before entering the iteration calculate <math>E_{ext} (\bar v_i) </math>and the derivatives of this w.r.t. x and y separately. |
|||
# At the start of the iteration, calculate <math>\frac{\partial ^2 x}{\partial s^2}(\bar v_i) </math>and <math>\frac{\partial ^2 y}{\partial s^2} (\bar v_i) </math> using the three adjacent points and <math> \frac{\partial ^4 y}{\partial s^4} (\bar v_i),\frac{\partial ^4 x}{\partial s^4} (\bar v_i)</math> using five adjacent points. |
|||
# Then, calculate change in x and y for each point in <math> \bar v_i </math> Use the precalculated <math>E_{ext} (\bar v_i) </math>. |
|||
This can be solved through iteration towards a steady-state value. |
|||
==Advantages and drawbacks== |
|||
:<math> u_{i+1} = u_i + \mu \nabla^2 u_i - \Bigg (u_i - \frac{\partial}{\partial x}F_{ext}\Bigg )\Bigg (\frac{\partial}{\partial x}F_{ext}(x,y)^2 + \frac{\partial}{\partial y}F_{ext}(x,y)^2\Bigg ) </math> |
|||
Snakes have multiple advantages over classical feature attraction techniques. |
|||
# Snakes are autonomous and self-adapting in their search for a minimal energy state. |
|||
# They can be easily manipulated using external image forces. |
|||
# They can be made sensitive to image scale by incorporating Gaussian smoothing in the image energy function. |
|||
# They can be used to track dynamic objects in temporal as well as the spatial dimensions. |
|||
:<math> v_{i+1} = v_i + \mu \nabla^2 v_i - \Bigg (v_i - \frac{\partial}{\partial y}F_{ext}\Bigg )\Bigg (\frac{\partial}{\partial x}F_{ext}(x,y)^2 + \frac{\partial}{\partial y}F_{ext}(x,y)^2\Bigg ) </math> |
|||
The key drawbacks of the traditional snakes are |
|||
This result replaces the default external force. |
|||
# They can often get stuck in local minima states; this may be overcome by using simulated annealing techniques at the expense of longer computation times. |
|||
# They often overlook minute features in the process of minimizing the energy over the entire path of their contours. |
|||
# Their accuracy is governed by the convergence criteria used in the energy minimization technique; higher accuracies require tighter convergence criteria and hence, longer computation times.<ref>Snakes: an active model,Ramani Pichumani,http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/RAMANI1/node31.html</ref> |
|||
:<math> F_{ext}^* = F_{GVF} </math> |
|||
== Other implementations of snakes == |
|||
The primary issue with using GVF is the smoothing term <math> \mu </math> causes rounding of the edges of the contour. Reducing the value of <math> \mu </math> reduces the rounding but weakens the amount of smoothing. |
|||
=== GVF active contours === |
|||
===The Balloon Model=== |
|||
The snake is developed based on a new type of external field, called Gradient Vector Flow, or GVF. This computation causes diffuse forces to exist far from the object, and crisp force vectors near the edges. Combining these forces with the usual internal forces yields a powerful computational object: the GVF snake (2D), or the GVF deformable model (N-D). Even though this snake is started far from the object, it still gets attracted towards the object.<ref name="gvf">Chenyang Xu and Jerry L. Prince,IACL,http://www.iacl.ece.jhu.edu/enwiki/static/gvf/</ref> Especially, GVF active contours can handle broken object edges and subjective contours.<ref name="gvf"/> |
|||
The Balloon Model<ref name="balloon" /> addresses these problems with the default active contour model: |
|||
=== Balloon snake=== |
|||
* The snake is not attracted to distant edges. |
|||
In this case, the snake behaves like a balloon which is blown up. When it passes by edges, it is stopped if the contour is strong,or passes through if the contour is too weak. Thus, the initial snake need not be too close to the solution(object) to converge. This approach modifies the definition external forces (derived from gradient of the image) presented in traditional snake (Kass ''et al''). A new pressure force is introduced which makes the curve behave like a balloon.<ref>On Active Contour Models, Laurent D. COHEN,http://hal.archives-ouvertes.fr/docs/00/07/54/84/PDF/RR-1075.pdf</ref> |
|||
* The snake will shrink inwards if no substantial images forces are acting upon it. |
|||
* a snake larger than the minima contour will eventually shrink into it, but a snake smaller than the minima contour will not find the minima and instead continue to shrink. |
|||
The balloon model introduces an inflation term into the forces acting on the snake |
|||
===Diffusion snakes=== |
|||
:<math>F_{inflation} = k_1 \vec n (s) </math> |
|||
The diffusion snake is a modification of the [[Mumford-Shah Functional|Mumford-Shah functional]] for spline contours. A modification of the Mumford-Shah functional and its cartoon limit is used to incorporate statistical prior on the shape of the segmenting contour. By minimizing a single energy functional, we obtain a segmentation process which maximizes both the Grey value homogeneity in the separated regions and the similarity of the contour with respect to a set of training shapes.<ref>Diffusion Snakes: Statistical Shape Knowledge in Mumford-Shah Based Segmentation,Daniel Cremers, Christoph Schnörr and Joachim Weickert http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/CREMERS2/</ref> |
|||
where <math> \vec n (s) </math> is the normal unitary vector of the curve at <math> v(s) </math> and <math> k_1 </math> is the magnitude of the force. <math> k_1 </math> should have the same magnitude as the image normalization factor <math> k </math> and be smaller in value than <math> k </math> to allow forces at image edges to overcome the inflation force. |
|||
Three issues arise from using the balloon model: |
|||
*Instead of shrinking, the snake expands into the minima and will not find minima contours smaller than it. |
|||
*The outward force causes the contour to be slightly larger than the actual minima. This can be solved by decreasing the balloon force after a stable solution has been found. |
|||
*The inflation force can overpower forces from weak edges, amplifying the issue with snakes ignoring weaker features in an image. |
|||
===Diffusion Snakes Model=== |
|||
The Diffusion Snake Model<ref name='diffusion'>Cremers, D.; Schnorr, C.; Weickert, J., "Diffusion-snakes: combining statistical shape knowledge and image information in a variational framework," Variational and Level Set Methods in Computer Vision, 2001. Proceedings. IEEE Workshop on , vol., no., pp.137,144, 2001 |
|||
doi: 10.1109/VLSM.2001.938892 http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=938892&tag=1</ref> addresses the sensitivity of snakes to noise, clutter, and occlusion. It implements a modification of the [[Mumford-Shah Functional|Mumford-Shah functional]] and its cartoon limit and incorporates statistical shape knowledge. The default image energy functional <math> E_{image} </math> is replaced with |
|||
:<math> |
|||
E_{image}^* = E_i + \alpha E_c |
|||
</math> |
|||
where <math> E_i </math> is based on a modified Mumford-Shah functional |
|||
:<math> |
|||
E[J,B] = \frac{1}{2} \int _D (I(\vec x) - J(\vec x))^2 d \vec x + \lambda \frac{1}{2} \int _{D/B} \vec \nabla J(\vec x) \cdot \vec \nabla J(\vec x) d \vec x + \nu \int _0^1 \Bigg ( \frac{d}{ds}B(s) \Bigg )^2 ds |
|||
</math> |
|||
where <math> J(\vec x) </math> is the piecewise smooth model of the image <math> I(\vec x) </math> of domain <math> D </math>. Boundaries <math> B(s) </math> are defined as |
|||
:<math> |
|||
B(s) = \sum_{n=1}^N \vec p_n B_n (s) |
|||
</math> |
|||
where <math> B_n (s) </math> are quadratic B-spline basis functions and <math> \vec p_n </math> are the control points of the splines. The modified cartoon limit is obtained as <math> \lambda \to \infty </math> and is a valid configuration of <math> E_i </math>. |
|||
The functional <math>E_c</math> is based on training from binary images of various contours and is controlled in strength by the parameter <math> \alpha </math>. For a Gaussian distribution of control point vectors <math> \vec z </math> with mean control point vector <math> \vec z_0 </math> and covariance matrix <math> \Sigma </math> , the quadratic energy that corresponds to the Gaussian probability is |
|||
:<math> |
|||
E_c(\vec z) = \frac{1}{2} (\vec z - \vec z_0)^t \Sigma^*(\vec z - \vec z_0) |
|||
</math> |
|||
The strength of this method relies on the strength of the training data as well as the tuning of the modified Mumford-Shah Functional. Different snakes will require different training data sets and tunings. |
|||
===Geometric Active Contours=== |
===Geometric Active Contours=== |
||
Geometric snakes, or geodesic snakes <ref>Geodesic Active Contours, V. Caselles, R. Kimmel, G. Sapiro http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.21.2196</ref>, or conformal active contours<ref>Conformal curvature flows: From phase transitions to active vision, Satyanad Kichenassamy, Arun Kumar, Peter Olver, Allen Tannenbaum and Anthony Yezzi http://www.springerlink.com/content/u457157212872201/</ref> employs ideas from Euclidean curve shortening evolution. Contours split and merge depending on the detection of objects in the image. These models are largely implemented using [[level sets]], and have been extensively employed in [[medical image computing]]. The level set function <math> \Phi </math> used in this method is of the form |
|||
This class of snake models employs ideas from Euclidean curve shortening evolution which defines the gradient direction |
|||
in which the Euclidean perimeter is shrinking as fast as possible. One therefore notes that |
|||
:<math> |
|||
new active contour models may be derived by multiplying the Euclidean arc-length by a conformal factor tailored to the features of interest that one wants to capture, then writing down the resulting gradient |
|||
\frac{\partial}{\partial t}\Phi = |\nabla \Phi| DIV \Bigg ( \frac{g(I)}{\nabla \Phi} \nabla \Phi \Bigg ) + \nabla g(I) \cdot \nabla \Phi |
|||
evolution equations. The latter becomes a curve shortening equation with respect to the new conformally Euclidean metric. |
|||
</math> |
|||
These models may be implemented using [[level sets]], and have been extensively employed in [[medical image computing]]. |
|||
They have been called geodesic snakes <ref>Geodesic Active Contours, V. Caselles, R. Kimmel, G. Sapiro http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.21.2196</ref> and conformal active contours.<ref>Conformal curvature flows: From phase transitions to active vision, Satyanad Kichenassamy, Arun Kumar, Peter Olver, Allen Tannenbaum and Anthony Yezzi http://www.springerlink.com/content/u457157212872201/</ref> Statistical models combining local and global features |
|||
where <math> g(I) </math> is a halting function. |
|||
have been formulated in.<ref>Localizing region-based active contours, Shawn Lankton and Allen Tannenbaum http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.178.2796/{{Dead link |date=June 2014}}</ref> |
|||
Statistical models combining local and global features have been formulated by Lankton and Tannenbaum.<ref>Lankton, S.; Tannenbaum, A., "Localizing Region-Based Active Contours," Image Processing, IEEE Transactions on , vol.17, no.11, pp.2029,2039, Nov. 2008 doi: 10.1109/TIP.2008.2004611 http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=4636741&tag=1</ref> |
|||
==Sample |
==Sample Code== |
||
#[http://www.icaen.uiowa.edu/~image/Prince-snakes/ Practical examples of different snakes developed by Prince and Xu |
#[http://www.icaen.uiowa.edu/~image/Prince-snakes/ Practical examples of different snakes] developed by Prince and Xu |
||
#[http://www.isbe.man.ac.uk/~bim/software/qsnake_demo/qsnake_demo.html Basic tool to play with snakes (active contour models) from Tim Cootes,University of Manchester] |
#[http://www.isbe.man.ac.uk/~bim/software/qsnake_demo/qsnake_demo.html Basic tool to play with snakes (active contour models) from Tim Cootes,University of Manchester] |
||
#[http://www.mathworks.com/matlabcentral/fileexchange/28149 Matlab implementation of 2D and 3D snake including GVF and balloon force] |
#[http://www.mathworks.com/matlabcentral/fileexchange/28149 Matlab implementation of 2D and 3D snake including GVF and balloon force] |
||
#[ |
#[https://engineering.purdue.edu/~malcolm/interval/1995-017/snake.m Matlab Snake Demo] by Chris Bregler and Malcolm Slaney, Interval Research Corporation. |
||
#[http://www.markschulze.net/snakes/ A Demonstration Using Java] |
#[http://www.markschulze.net/snakes/ A Demonstration Using Java] |
||
#[http://www.mathworks.com/matlabcentral/fileexchange/30284-active-contours-implementation---test-platform-gui Active Contours implementation & test platform GUI] by Nikolay S. and Alex Blekhman implementing "Active Contours without Edges" |
|||
#[http://www.mathworks.com/matlabcentral/fileexchange/19567-active-contour-segmentation Active Contour Segmentation] by Shawn Lankton implementing "Active Contours without Edges" |
|||
#[http://www.jarnoralli.fi/joomla/code/active-contour-code Geometric Active Contour Code] by Jarno Ralli |
|||
#[https://github.com/pmneila/morphsnakes Morphological Snakes] |
|||
==See |
==See Also== |
||
#[http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/YOUNG/vision7.html David Young, March 1995] |
#[http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/YOUNG/vision7.html David Young, March 1995] |
||
# [http://homepages.inf.ed.ac.uk/cgi/rbf/CVONLINE/entries.pl?TAG709 Snakes: Active Contours, CVOnline] |
# [http://homepages.inf.ed.ac.uk/cgi/rbf/CVONLINE/entries.pl?TAG709 Snakes: Active Contours, CVOnline] |
||
# [http://www.isbe.man.ac.uk/courses/Computer_Vision/downloads/L11_Snakes.pdf ICBE,University of Manchester] |
# [http://www.isbe.man.ac.uk/courses/Computer_Vision/downloads/L11_Snakes.pdf ICBE,University of Manchester] |
||
# [http://www.mathworks.com/matlabcentral/fileexchange/30284-active-contours-implementation---test-platform-gui Active Contours implementation & test platform GUI] |
|||
#[http://www.cb.uu.se/~cris/blog/index.php/archives/217 A simple implementation of snakes] by Associate Professor Cris Luengo |
|||
#[http://www.mathworks.com/help/images/ref/activecontour.html MATLAB documentation for activecontour, which segments an image using active contours] |
|||
==References== |
==References== |
||
Line 215: | Line 315: | ||
{{DEFAULTSORT:Active Contour Model}} |
{{DEFAULTSORT:Active Contour Model}} |
||
[[Category:Computer vision]] |
[[:Category:Computer vision]] |
Revision as of 21:34, 13 December 2014
Active contour model, also called snakes, is a framework in computer vision for delineating an object outline from a possibly noisy 2D image. The snakes model is popular in computer vision, and Snakes are greatly used in applications like object tracking, shape recognition, segmentation, edge detection, stereo matching.
A snake is an energy minimizing, deformable spline influenced by constraint and image forces that pull it towards object contours and internal forces that resist deformation. Snakes may be understood as a special case of the general technique of matching a deformable model to an image by means of energy minimization.[1] In two dimensions, the active shape model represents a discrete version of this approach, taking advantage of the point distribution model to restrict the shape range to an explicit domain learned from a training set.
Snakes do not solve the entire problem of finding contours in images, since the method requires knowledge of the desired contour shape beforehand. Rather, they depend on other mechanisms such as interaction with a user, interaction with some higher level image understanding process, or information from image data adjacent in time or space.
Motivation
In computer vision, contour models describe the boundaries of shapes in an image. Snakes in particular is designed to solve problems where the approximate shape of the boundary is known. By being a deformable model, snakes can adapt to differences and noise in stereo matching and motion tracking. Additionally, the method can find Illusory contours in the image by ignoring missing boundary information.
Compared to classical feature attraction techniques, Snakes have multiple advantages:
- They autonomously and adaptively search for the minimum state.
- External image forces act upon the snake in an intuitive manner.
- Incorporating Gaussian smoothing in the image energy function introduces scale sensitivity.
- They can be used to track dynamic objects.
The key drawbacks of the traditional snakes are
- They are sensitive to local minima states, which can be counteracted by simulated annealing techniques.
- Minute features are often ignored during energy minimization over the entire contour.
- Their accuracy depends on the convergence policy. [2]
Energy Formulation
A simple elastic snake is defined by a set of n points where , the internal elastic energy term , and the external edge-based energy term . The purpose of the internal energy term is to control the deformations made to the snake, and the purpose of the external energy term is to control the fitting of the contour onto the image. The external energy is usually a combination of the forces due to the image itself and the constraint forces introduced by the user
The energy function of the snake is the sum of its external energy and internal energy, or
Internal Energy
The internal energy of the snake is comprised of the continuity of the contour and the smoothness of the contour .
This can be expanded as
Where and are user-defined weights; these control the internal energy function's sensitivity to the amount of stretch in the snake and the amount of curvature in the snake, respectively, and thereby control the number of constraints on the shape of the snake.
In practice, a large weight for the continuity term penalizes changes in distances between points in the contour. A large weight for the smoothness term penalizes oscillations in the contour and will cause the contour to act as a thin plate.
Image Energy
Energy in the image is some function of the features of the image. This is one of the most common points of modification in derivative methods. Features in images and images themselves can be processed in many and various ways.
For an image , lines, edges, and terminations present in the image, the general formulation of energy due to the image is
- ,
where , , are weights of these salient features. Higher weights indicate that the salient feature will have a larger contribution to the image force.
Line Functional
The line functional is the intensity of the image, which can be represented as
The sign of will determine whether the line will be attracted to either dark lines or light lines.
Some smoothing or noise reduction may be used on the image, which then the line functional appears as
Edge Functional
The edge functional is based on the image gradient. One implementation of this is
A snake originating far from the desired object contour may erroneously converge to some local minimum. Scale space continuation can be used in order to avoid these local minima. This is achieved by using a blur filter on the image and reducing the amount of blur as the calculation progresses to refine the fit of the snake. The energy functional using scale space continuation is
where is a Gaussian with standard deviation . Minima of this function fall on the zero-crossings of which define edges as per Marr-Hildreth Theory.
Termination Functional
Curvature of level lines in a slightly smoothed image can be used to detect corners and terminations in an image. Using this method, let be the image smoothed by
with gradient angle
- ,
unit vectors along the gradient direction
- ,
and unit vectors perpendicular to the gradient direction
- .
The termination functional of energy can be represented as
Constraint Energy
Some systems, including the original snakes implementation, allowed for user interaction to guide the snakes, not only in initial placement but also in their energy terms. Such constraint energy can be used to interactively guide the snakes towards or away from particular features.
Optimization Through Gradient-Descent Minimization
Given an initial guess for a snake, the energy function of the snake is iteratively minimized. Gradient descent minimization is one of the simplest optimizations which can be used to minimize snake energy. [4] Each iteration takes one step in the negative gradient of the point with controlled step size to find local minima. This gradient-descent minimization can be implemented as
Where is the force on the snake, which is defined by the negative of the gradient of the energy field.
Assuming the weights and are constant with respect to , this iterative method can be simplified to
Discrete Approximation
In practice, images have finite resolution and can only be integrated over finite time steps . As such, discrete approximations must be made for practical implementation of snakes.
The energy function of the snake can be approximated by using the discrete points on the snake.
Consequentially, the forces of the snake can be approximated as
Gradient approximation can be done through any finite approximation method with respect to s, such as Finite difference.
Numerical Instability Due to Discrete Time
The introduction of discrete time into the algorithm can introduce updates which the snake is moved past the minima it is attracted to; this further can cause oscillations around the minima or lead to a different minima being found.
This can be avoided through tuning the time step such that the step size is never greater than a pixel due to the image forces. However, in regions of low energy, the internal energies will dominate the update.
Alternatively, the image forces can be normalized for each step such that the image forces only update the snake by one pixel. This can be formulated as
where is near the value of the pixel size. This avoids the problem of dominating internal energies that arise from tuning the time step.[5]
Numerical Instability Due to Discrete Space
The energies in a discrete image may have zero-crossing that do not exist as a pixel in the image. In this case, a point in the snake would oscillate between the two pixels that neighbor this zero-crossing. This oscillation can be avoided by using interpolation between pixels instead of nearest neighbor.[5]
Implementation
The following pseudocode implements the snakes method in a general form
function v = snakes (I, v)
% INPUT: N by M image I, a contour v of n control points
% OUTPUT: converged contour v of n control points
E_image = generateImageEnergy (I);
while not converged
F_cont = weight.alpha * contourDerivative(v, 2);
F_curv = weight.beta * contourDerivative(v, 4);
F_image = interp2 (E_image, v(:,2), v(:,1);
F_image_norm = weight.k * F_image ./ norm (F_image);
F_con = inputForces();
F_internal = F_cont + weight.external * F_curv;
F_external = weight.external * (F_image + F_con);
v = updateSnake(v, F_internal, F_external);
checkConvergence ();
end
end
Where generateImageEnergy (I) can be written as
function E_image = generateImageEnergy (I)
[C, Cx, Cy, Cxx, Cxy, Cyy] = generateGradients (I);
E_line = I;
E_edge = -(Cx.^2 + Cy.^2)^0.5;
E_term = (Cyy.*Cx.^2 - 2*Cxy.*Cx.*Cy + Cxx.*Cy.^2)./((1 + Cx.^2 + Cy.^2).^(1.5));
E_image = weight.line * E_line + weight.edge * E_edge + weight.term * E_term;
end
Some Variants of Snakes
The default method of snakes has various limitation and corner cases where the convergence performs poorly. Several alternatives exist which addresses issues of the default method, though with their own trade-offs. A few are listed here.
GVF Snake Model
The Gradient Vector Flow (GVF) Snake Model[6] addresses two issues with snakes:
- poor convergence performance for concave boundaries
- poor convergence performance when snake is initialized far from minimum
In 2D, the GVF vector field minimizes the energy functional
where is a controllable smoothing term. This can be solved by solving the Euler equations
This can be solved through iteration towards a steady-state value.
This result replaces the default external force.
The primary issue with using GVF is the smoothing term causes rounding of the edges of the contour. Reducing the value of reduces the rounding but weakens the amount of smoothing.
The Balloon Model
The Balloon Model[5] addresses these problems with the default active contour model:
- The snake is not attracted to distant edges.
- The snake will shrink inwards if no substantial images forces are acting upon it.
- a snake larger than the minima contour will eventually shrink into it, but a snake smaller than the minima contour will not find the minima and instead continue to shrink.
The balloon model introduces an inflation term into the forces acting on the snake
where is the normal unitary vector of the curve at and is the magnitude of the force. should have the same magnitude as the image normalization factor and be smaller in value than to allow forces at image edges to overcome the inflation force.
Three issues arise from using the balloon model:
- Instead of shrinking, the snake expands into the minima and will not find minima contours smaller than it.
- The outward force causes the contour to be slightly larger than the actual minima. This can be solved by decreasing the balloon force after a stable solution has been found.
- The inflation force can overpower forces from weak edges, amplifying the issue with snakes ignoring weaker features in an image.
Diffusion Snakes Model
The Diffusion Snake Model[7] addresses the sensitivity of snakes to noise, clutter, and occlusion. It implements a modification of the Mumford-Shah functional and its cartoon limit and incorporates statistical shape knowledge. The default image energy functional is replaced with
where is based on a modified Mumford-Shah functional
where is the piecewise smooth model of the image of domain . Boundaries are defined as
where are quadratic B-spline basis functions and are the control points of the splines. The modified cartoon limit is obtained as and is a valid configuration of .
The functional is based on training from binary images of various contours and is controlled in strength by the parameter . For a Gaussian distribution of control point vectors with mean control point vector and covariance matrix , the quadratic energy that corresponds to the Gaussian probability is
The strength of this method relies on the strength of the training data as well as the tuning of the modified Mumford-Shah Functional. Different snakes will require different training data sets and tunings.
Geometric Active Contours
Geometric snakes, or geodesic snakes [8], or conformal active contours[9] employs ideas from Euclidean curve shortening evolution. Contours split and merge depending on the detection of objects in the image. These models are largely implemented using level sets, and have been extensively employed in medical image computing. The level set function used in this method is of the form
where is a halting function.
Statistical models combining local and global features have been formulated by Lankton and Tannenbaum.[10]
Sample Code
- Practical examples of different snakes developed by Prince and Xu
- Basic tool to play with snakes (active contour models) from Tim Cootes,University of Manchester
- Matlab implementation of 2D and 3D snake including GVF and balloon force
- Matlab Snake Demo by Chris Bregler and Malcolm Slaney, Interval Research Corporation.
- A Demonstration Using Java
- Active Contours implementation & test platform GUI by Nikolay S. and Alex Blekhman implementing "Active Contours without Edges"
- Active Contour Segmentation by Shawn Lankton implementing "Active Contours without Edges"
- Geometric Active Contour Code by Jarno Ralli
- Morphological Snakes
See Also
- David Young, March 1995
- Snakes: Active Contours, CVOnline
- ICBE,University of Manchester
- Active Contours implementation & test platform GUI
- A simple implementation of snakes by Associate Professor Cris Luengo
- MATLAB documentation for activecontour, which segments an image using active contours
References
- ^ Attention: This template ({{cite doi}}) is deprecated. To cite the publication identified by doi:10.1007/BF00133570, please use {{cite journal}} (if it was published in a bona fide academic journal, otherwise {{cite report}} with
|doi=10.1007/BF00133570
instead. - ^ Snakes: an active model,Ramani Pichumani,http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/RAMANI1/node31.html
- ^ Dr. George Bebis,University of Nevada,http://www.cse.unr.edu/~bebis/CS791E/Notes/DeformableContours.pdf
- ^ Image Understanding,Bryan S. Morse,Brigham Young University,1998-2000 http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/MORSE/iu.pdf
- ^ a b c Laurent D. Cohen, On active contour models and balloons, CVGIP: Image Understanding, Volume 53, Issue 2, March 1991, Pages 211-218, ISSN 1049-9660, http://dx.doi.org/10.1016/1049-9660(91)90028-N. (http://www.sciencedirect.com/science/article/pii/104996609190028N)
- ^ 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, http://iacl.ece.jhu.edu/pubs/p087c.pdf
- ^ Cremers, D.; Schnorr, C.; Weickert, J., "Diffusion-snakes: combining statistical shape knowledge and image information in a variational framework," Variational and Level Set Methods in Computer Vision, 2001. Proceedings. IEEE Workshop on , vol., no., pp.137,144, 2001 doi: 10.1109/VLSM.2001.938892 http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=938892&tag=1
- ^ Geodesic Active Contours, V. Caselles, R. Kimmel, G. Sapiro http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.21.2196
- ^ Conformal curvature flows: From phase transitions to active vision, Satyanad Kichenassamy, Arun Kumar, Peter Olver, Allen Tannenbaum and Anthony Yezzi http://www.springerlink.com/content/u457157212872201/
- ^ Lankton, S.; Tannenbaum, A., "Localizing Region-Based Active Contours," Image Processing, IEEE Transactions on , vol.17, no.11, pp.2029,2039, Nov. 2008 doi: 10.1109/TIP.2008.2004611 http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=4636741&tag=1