Binarize

Binarize[image]
creates a binary image from image by replacing all values above a globally determined threshold with and others with .

Binarize[image,t]
creates a binary image by replacing all values above t with and others with .

Binarize[image,{t1,t2}]
creates a binary image by replacing all values in the range through with and others with .

Binarize[image,f]
creates a binary image by replacing all channel value lists for which yields True with , and others with .

Details and OptionsDetails and Options

  • Binarize works with any image. It converts multichannel and color images into grayscale images, then produces an image in which every pixel has value or .
  • Binarize[image,{t,t}] effectively sets pixels with value t to , and all other pixels to .
  • Binarize[image,0] sets all nonzero values to .
  • In Binarize[image,f], the function f is applied to the list of channel values for each pixel.
  • Binarize[image] uses Otsu's cluster variance maximization method. See the reference page for FindThreshold for full documentation of available Method settings.
  • Binarize[image] uses Otsu's cluster variance maximization method. Other possible settings for the Method option include:
  • {"BlackFraction",b}make a fraction b of all pixels black
    "Cluster"cluster variance maximization (Otsu's algorithm)
    "Entropy"histogram entropy minimization (Kapur's method)
    "Mean"use the mean level as the threshold
    "Median"use the median pixel level as the threshold
    "MinimumError"KittlerIllingworth minimum error thresholding method
  • If an explicit threshold value is given, Binarize ignores the Method option. »
  • Binarize also works with Image3D objects.

Background
Background

  • Binarize creates a two-level (binary) version of an image whose pixel values correspond to 0s and 1s. Binarize enhances contrast and is typically used for feature detection, image segmentation, or as a preprocessing step prior to application of other image processing functions.
  • Binarize is particularly effective when all foreground pixels have higher intensity values than background pixels. It is a pixel (or point) operation, meaning it is applied to each pixel independently.
  • Binarize implements intensity thresholding and other binary segmentation methods for images and can operate either automatically or given explicit cutoff values. Applying Binarize removes any alpha channel present and produces an image having a single channel.
  • Other more advanced binary segmentation functions include MorphologicalBinarize, RegionBinarize, and ChanVeseBinarize.
Introduced in 2008
(7.0)
| Updated in 2012
(9.0)