Sparse Field Methods for Active Contours

Very fast implementation of level sets. 2D and 3D support, written in C++/MEX with MATLAB wrapper.

You are now following this Submission

Active contour methods for image segmentation allow a contour to deform iteratively to partition an image into regions. Active contours are often implemented with level set methods because of their power and versatility. The primary drawback of level set methods is that they are slow to compute. This code implements the very efficient sparse field method (SFM) proposed by Whitaker. Specifically, the well-known Chan-Vese energy is minimized.
To run the MATLAB demo, simply unzip the file and run:

>>sfm_chanvese_demo

at the MATLAB prompt. On the first run, this will compile the MEX code on your machine and then run the demo. If the MEX compile fails, please check your MEX setup. The demo is for a 2D image, but the codes work for 3D images as well.

My hope is that other researchers wishing to quickly implement Whitaker’s method can use this information to understand the intricacies of the algorithm and enjoy the same SUBSTANTIAL speed-ups I have.

For a full technical report detailing the algorithm and implementation, please check this post:

[ http://www.shawnlankton.com/2009/04/sfm-and-active-contours ]

Cite As

Shawn Lankton (2026). Sparse Field Methods for Active Contours (https://www.mathworks.com/matlabcentral/fileexchange/23847-sparse-field-methods-for-active-contours), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.2.0.0

Added BSD License
Fixed some bugs, and updated the demo script. Thanks to Sebastien Paris for pointing out a bug in the comments! FIXED.

1.1.0.0

Fixed bug in the prototype for ls_iteration()

1.0.0.0