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

Binarize

Binarize[image]
creates a binary image from image by replacing all values above a globally determined threshold with and others with .
Binarize
creates a binary image by replacing all values above t with and others with .
Binarize
creates a binary image by replacing all values in the range through with and others with .
Binarize
creates a binary image by replacing all channel value lists for which yields True with , and others with .
  • 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 effectively sets pixels with value t to , and all other pixels to .
  • In Binarize, the function f is applied to the list of channel values for each pixel.
  • Binarize uses Otsu's cluster variance maximization method. See the reference page for FindThreshold for full documentation of available Method settings.
  • If an explicit threshold value is given, Binarize will ignore the Method option.
Convert a color image to binary:
Binarize with an explicit global threshold:
Find pixels where the red channel is larger than the green channel:
Convert a color image to binary:
In[1]:=
Click for copyable input
Out[1]=
 
Binarize with an explicit global threshold:
In[1]:=
Click for copyable input
Out[1]=
 
Find pixels where the red channel is larger than the green channel:
In[1]:=
Click for copyable input
Out[1]=
Binarize a gradient image with a specific black fraction to find the strongest edges:
Segment components of a specific color in an image:
Set all non-white pixels to black:
New in 7