Full search page →

The GVF energy and its diffusion equations

Optional · supplementary note 2 of 9 for IP 11 · Image Segmentation II: Active Contours — Snakes and Level Sets. Nothing in the main text depends on it; citation numbers refer to the reference list at the bottom of this page.

Navigate: this page and this track: Navigate: this page and this track

GVF keeps the good part of ∇e\nabla e (accurate, pointing at edges where edges exist) and fills in the rest of the image by smooth diffusion. Xu and Prince [3] define the GVF field w(x,y)=(u(x,y),v(x,y))\mathbf{w}(x, y) = (u(x, y), v(x, y)) as the minimizer of

E(w)=∬Ωμ (ux2+uy2+vx2+vy2)  +  ∣∇e∣2 ∣w−∇e∣2  dx dy.\mathcal{E}(\mathbf{w}) = \iint_\Omega \mu\,\big(u_x^2 + u_y^2 + v_x^2 + v_y^2\big) \;+\; \lvert\nabla e\rvert^2\,\lvert \mathbf{w} - \nabla e\rvert^2 \; dx\,dy .
  • ux,uy,vx,vyu_x, u_y, v_x, v_y are the partial derivatives of the two field components; the first term asks the field to vary slowly.
  • ∣∇e∣2 ∣w−∇e∣2\lvert\nabla e\rvert^2\,\lvert\mathbf{w} - \nabla e\rvert^2 asks w\mathbf{w} to equal ∇e\nabla e, but only where ∣∇e∣\lvert\nabla e\rvert is large, that is, near edges.
  • μ>0\mu > 0 balances the two; it should grow with the noise level.

The Euler–Lagrange equations are a pair of decoupled diffusion equations. Solving them by gradient descent in time gives

ut=μ ∇2u−(u−ex) ∣∇e∣2,vt=μ ∇2v−(v−ey) ∣∇e∣2,u_t = \mu\,\nabla^2 u - (u - e_x)\,\lvert\nabla e\rvert^2, \qquad v_t = \mu\,\nabla^2 v - (v - e_y)\,\lvert\nabla e\rvert^2,

where ∇2\nabla^2 is the Laplacian and exe_x, eye_y are the components of ∇e\nabla e. Far from edges the second term vanishes and the field simply diffuses outward from the edges, carrying their direction with it. For the unit-spaced 5-point stencil, collect the terms at an interior pixel. With bij=∣∇eij∣2b_{ij}=|\nabla e_{ij}|^2, one component updates as

uijn+1=[1−Δt(4μ+bij)]uijn+Δtμ∑(k,l)∈N4(i,j)ukln+Δtbijex,ij.\begin{aligned} u^{n+1}_{ij} &= [1-\Delta t(4\mu+b_{ij})]u^n_{ij} \\ &\quad+\Delta t\mu\sum_{(k,l)\in N_4(i,j)}u^n_{kl} +\Delta t b_{ij}e_{x,ij}. \end{aligned}

Here nn is the iteration, Δt\Delta t the time step, and N4(i,j)N_4(i,j) the four direct neighbors; ex,ije_{x,ij} is fixed during the solve. The weights sum to one. Requiring Δt(4μ+max⁡b)≤1\Delta t(4\mu+\max b)\le1 makes every weight nonnegative, giving a conservative boundedness condition for this update with the replicated borders used in the code. The familiar μΔt≤1/4\mu\Delta t\le1/4 limit covers diffusion alone and does not account for the reaction term. This is a sufficient condition derived from the discrete stencil, not the sharpest possible stability limit. Scaling ee changes bb, so it also changes the allowed step size. A fixed iteration count represents an evolution time of nΔtn\Delta t; it is not itself a convergence test.

References

  1. R. C. Gonzalez and R. E. Woods, Digital Image Processing, 4th ed., Pearson, 2018, Ch. 11. publisher page
  2. M. Kass, A. Witkin, and D. Terzopoulos, “Snakes: Active contour models,” International Journal of Computer Vision, vol. 1, no. 4, pp. 321–331, 1988. doi:10.1007/BF00133570
  3. C. Xu and J. L. Prince, “Snakes, shapes, and gradient vector flow,” IEEE Transactions on Image Processing, vol. 7, no. 3, pp. 359–369, 1998; see also C. Xu, A. Yezzi Jr., and J. L. Prince, “On the relationship between parametric and geometric active contours,” Proc. 34th Asilomar Conf. on Signals, Systems, and Computers, 2000. GVF project page with both papers
  4. L. D. Cohen, “On active contour models and balloons,” CVGIP: Image Understanding, vol. 53, no. 2, pp. 211–218, 1991. author PDF
  5. S. Osher and J. A. Sethian, “Fronts propagating with curvature-dependent speed: Algorithms based on Hamilton–Jacobi formulations,” Journal of Computational Physics, vol. 79, pp. 12–49, 1988. doi:10.1016/0021-9991(88)90002-2
  6. V. Caselles, R. Kimmel, and G. Sapiro, “Geodesic active contours,” International Journal of Computer Vision, vol. 22, no. 1, pp. 61–79, 1997. PDF
  7. D. Mumford and J. Shah, “Optimal approximations by piecewise smooth functions and associated variational problems,” Communications on Pure and Applied Mathematics, vol. 42, no. 5, pp. 577–685, 1989. doi:10.1002/cpa.3160420503
  8. T. F. Chan and L. A. Vese, “Active contours without edges,” IEEE Transactions on Image Processing, vol. 10, no. 2, pp. 266–277, 2001. doi:10.1109/83.902291
  9. D. Adalsteinsson and J. A. Sethian, “A fast level set method for propagating interfaces,” Journal of Computational Physics, vol. 118, pp. 269–277, 1995. summary page
  10. C. Li, C. Xu, C. Gui, and M. D. Fox, “Distance regularized level set evolution and its application to image segmentation,” IEEE Transactions on Image Processing, vol. 19, no. 12, pp. 3243–3254, 2010. doi:10.1109/TIP.2010.2069690
  11. P. Márquez-Neila, L. Baumela, and L. Álvarez, “A morphological approach to curvature-based evolution of curves and surfaces,” IEEE Transactions on Pattern Analysis and Machine Intelligence, 2014. doi:10.1109/TPAMI.2013.106
  12. scikit-image developers, “skimage.segmentation” API reference (active_contour, chan_vese, morphological_chan_vese, morphological_geodesic_active_contour). docs
  13. T. McInerney and D. Terzopoulos, “Deformable models in medical image analysis: A survey,” Medical Image Analysis, vol. 1, no. 2, 1996. author PDF
  14. D. Cremers, M. Rousson, and R. Deriche, “A review of statistical approaches to level set segmentation: Integrating color, texture, motion and shape,” International Journal of Computer Vision, vol. 72, no. 2, pp. 195–215, 2007. doi:10.1007/s11263-006-8711-1
  15. Y. Chen, P. Ge, G. Wang, and H. Chen, “An overview of intelligent image segmentation using active contour models,” Intelligence & Robotics, vol. 3, no. 1, pp. 23–55, 2023. open access
  16. S. Bohlender, I. Oksuz, and A. Mukhopadhyay, “A survey on shape-constraint deep learning for medical image segmentation,” IEEE Reviews in Biomedical Engineering, vol. 16, pp. 225–240, 2023. arXiv:2101.07721
  17. S. Peng, W. Jiang, H. Pi, X. Li, H. Bao, and X. Zhou, “Deep snake for real-time instance segmentation,” CVPR, 2020. arXiv:2001.01629
  18. X. Chen, B. M. Williams, S. R. Vallabhaneni, G. Czanner, R. Williams, and Y. Zheng, “Learning active contour models for medical image segmentation,” CVPR, 2019. CVF open access
  19. B. Kim and J. C. Ye, “Mumford–Shah loss functional for image segmentation with deep learning,” IEEE Transactions on Image Processing, vol. 29, pp. 1856–1866, 2020. doi · arXiv:1904.02872
  20. H. Kervadec, J. Bouchtiba, C. Desrosiers, E. Granger, J. Dolz, and I. Ben Ayed, “Boundary loss for highly unbalanced segmentation,” Medical Image Analysis, vol. 67, 2021 (first presented at MIDL 2019). arXiv:1812.07032