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


gives a binary version of image that includes the foreground pixels of marker and also connected regions whose pixel values are within a distance d.
grows regions in marker by adding pixels whose average intensity is also constrained within an interval .
  • RegionBinarize implements a variety of region-growing methods to find a binary segmentation of an image.
  • In RegionBinarize, 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.
  • RegionBinarize works with arbitrary grayscale and multichannel images.
  • RegionBinarize takes a Method option to specify how to compute the distance between the values of pixels to be added and the image region to be grown. Pixels are included in the segmentation only if the distance is less than or equal to d. Possible settings are:
"MeanEuclidean"Euclidean distance to the mean of the region to be grown
"Mahalanobis"Mahalanobis distance
  • The default setting is Method.
  • The distance is a Euclidean distance with a metric that is the inverse of the covariance matrix of pixel values in the region to be grown. If the initial region consists of only one or two pixels, then the covariance matrix is computed from a range-1 neighborhood around those pixels.
  • RegionBinarize grows regions starting from marker by adding only pixels that are not connected to backgroundmarker.
  • The possible range for the distance parameter d depends on the distance method used as well as the dimension of the color space.
Binary segmentation of a color image:
Binary segmentation of a color image:
Click for copyable input
Binary segmentation of a grayscale image:
Use a lower and upper threshold to limit the growing of the region:
Grow the region by using only the constrained intensity values:
Use a background marker to segment a region from a background with a similar color:
Use multiple iterations to grow a larger region:
Use the Mahalanobis distance for growing the foreground region:
Segmentation of an MRI image, highlighting a brain tumor:
Find the skin-colored region in a portrait:
Find a background mask using multiple marker regions:
New in 8