Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Binarize image by thresholding

`BW = imbinarize(I)`

`BW = imbinarize(I,method)`

`BW = imbinarize(I,T)`

`BW = imbinarize(I,'adaptive',Name,Value)`

creates
a binary image from image `BW`

= imbinarize(`I`

)`I`

by replacing all
values above a globally determined threshold with `1`

s
and setting all other values to `0`

s. By default, `imbinarize`

uses
Otsu's method, which chooses the threshold value to minimize the intraclass
variance of the thresholded black and white pixels. `imbinarize`

uses
a 256-bin image histogram to compute Otsu's threshold. To use a different
histogram, see `otsuthresh`

. `BW`

is
the output binary image.

`BW = imbinarize(`

creates
a binary image from image `I`

,'adaptive',`Name,Value`

)`I`

using name-value
pairs to control aspects of adaptive thresholding.

The `'adaptive'`

method binarizes the image
using a locally adaptive threshold. `imbinarize`

computes
a threshold for each pixel using the local mean intensity around the
neighborhood of the pixel. (This technique is also called Bradley's
method.) The `'adaptive'`

method also uses a neighborhood
size of approximately 1/8th of the size of the image (computed as `2*floor(size(I)/16)+1`

).
To use a different first order local statistic or a different neighborhood
size, see `adaptthresh`

.

Was this topic helpful?