Mathematica > Data Manipulation > Image Processing & Analysis > Mathematical Morphology >

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
New in 7
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team