This is documentation for Mathematica 7, which was
based on an earlier version of the Wolfram Language.
 Built-in Mathematica Symbol Tutorials »| See Also »| More About »

# Binarize

 Binarize[image] creates a binary image from image by replacing all values above a globally determined threshold with 1 and others with 0. Binarize[image, t]creates a binary image by replacing all values above t with 1 and others with 0. Binarize[image, {t1, t2}]creates a binary image by replacing all values in the range t1 through t2 with 1 and others with 0. Binarize[image, f]creates a binary image by replacing all channel value lists for which f[v] yields True with 1, and others with 0.
• Binarize works with any image. It converts multichannel and color images into grayscale images, then produces an image in which every pixel has value 0 or 1.
• Binarize[image, {t, t}] effectively sets pixels with value t to 1, and all other pixels to 0.
• Binarize[image, 0] sets all nonzero values to 1.
• In Binarize[image, f], the function f is applied to the list of channel values for each pixel.
• Binarize[image, Method->method] specifies the method to use to determine the threshold.
• The default setting is Method->"Cluster", corresponding to cluster variance maximization.
• Possible settings for the Method option include:
 {"BlackFraction",b} make a fraction b of all pixels be 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" Kittler-Illingworth minimum error thresholding method
Convert a color image to binary:
Specify an explicit global threshold:
Use a threshold on the third color channel:
Convert a color image to binary:
 Out[1]=

Specify an explicit global threshold:
 Out[1]=

Use a threshold on the third color channel:
 Out[1]=
 Applications   (1)
Set all non-white pixels to black:
Vary the threshold between 0 (black) and 1 (white):
Use a random threshold:
New in 7