finds a two-level segmentation of image by computing optimal contours around regions of consistent intensity in image.


uses marker to create an initial contour.


specify the ChanVese weights μ, ν, λ1, and λ2.

Details and Options

  • ChanVeseBinarize implements an iterative active contour method to achieve a two-level segmentation of image.
  • ChanVeseBinarize works with arbitrary 2D as well as 3D images.
  • The target region marker can be any of the following:
  • markerimagea marker image
    {pos1,pos2,}a list of positions
    fgcolorforeground color
    {{fgcolor,bgcolor}}foreground and background colors
  • Positions posi are assumed to be in the standard image coordinate system.
  • ChanVeseBinarize uses the Euclidean distance between channel vectors to determine the similarity between pixels inside and outside of the contour.
  • The ChanVese segmentation of an image domain into the two segments and with contour minimizes the following functional of image :
  • F(c_1,c_2,Gamma)=mu Length[Gamma]+nu Area(D)+lambda_1int_DTemplateBox[{{f, -, {c, _, 1}}}, Abs]^2dxdy+lambda_2int_(Omega\D)TemplateBox[{{f, -, {c, _, 2}}}, Abs]^2dxdy
  • The functional is parametrized by the length penalty , the area penalty , and level penalties and .
  • The ChanVese algorithm partitions image such that the first segment will differ as little as possible from constant and the second segment will deviate as little as possible from constant . If constants and are not specified, one assumes c1=Mean[f] in , and c2=Mean[f] in .
  • The contour between the two resulting segments and will exhibit a short length for , and for the area of will tend to be small or for tend to be large.
  • ChanVeseBinarize iteratively minimizes a functional that is a weighted sum of the contour length, the enclosed area, and the deviation between the image and the two-level segmentation.
  • The maximum number of iteration steps is given by the MaxIterations option with default setting 100.


open allclose all

Basic Examples  (2)

Binary segmentation of a color image:

Segmentation of a 3D volume:

Scope  (8)

Specify the foreground color to be used for an initial marker:

Specify both foreground and background colors for creating an initial marker:

Use foreground edges as the marker image:

Control the area of the segmented region:

Increase the smoothness of the segmented region:

Increase the length penalty when segmenting noisy images:

Increase the penalty for the segment to select background pixels:

Increase the penalty for the segment to improve the segmentation of a satellite image:

Options  (1)

MaxIterations  (1)

By default, ChanVese segmentation iterates until convergence or until the maximum of 100 iterations:

Run only a single iteration:

Applications  (3)

Chroma key compositing:

Compose the separated foreground with a different background:

Find the precise contour of a coastline in a satellite image:

Improve text recognition of a noisy image:

Introduced in 2010
Updated in 2012