This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)


finds a two-level segmentation of image by computing optimal contours around regions of consistent intensity in image.
uses the foreground pixels of marker as the initial contours.
  • ChanVeseBinarize implements an iterative active contour method to achieve a two-level segmentation of an image.
  • In ChanVeseBinarize, marker can be given either as an image, a graphics object, or a list of points in the standard image coordinate system, where x runs from 0 to width and y runs from 0 to height, and position corresponds to the bottom-left corner of the image.
  • ChanVeseBinarize uses the Euclidean distance between channel vectors to determine the similarity between pixels inside and outside of the contour.
  • 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 weights can be specified with the following options:
"AreaPenalty"0penalty associated with the area enclosed by the contour
"LengthPenalty"0.03contour length penalty
"LevelPenalty"{1.0,1.0}penalties for the total pixel deviations in the two segments
"TargetColor"Automatictarget foreground color
  • With the setting , both foreground and background colors can be specified.
  • The maximum number of iteration steps is given by the MaxIterations option with default setting 100.
  • The Chan-Vese segmentation of an image domain into the two segments and with contour minimizes the following functional of image :
  • The Chan-Vese functional is parametrized by the length penalty , the area penalty , and level penalties and .
  • The Chan-Vese 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.
  • The weighting coefficients , , , and are accessible through the following options.
Binary segmentation of a satellite image:
Binary segmentation of a satellite image:
Click for copyable input
Binary segmentation of a color image:
Use an edge marker to improve the segmentation:
Control the area of the segmented region:
Increase the smoothness of the segmented region:
Increase the length penalty when segmenting noisy images:
Specify the foreground color:
Specify both foreground and background target colors:
Chroma key compositing:
Find the precise contour of a coastline in a satellite image:
New in 8