multithresh
Multilevel image thresholds using Otsu’s method
Description
returns
the single threshold value thresh
= multithresh(A
)thresh
computed for
image A
using Otsu’s method. You can use thresh
as
an input argument to imquantize
to
convert an image into a two-level image.
returns thresh
= multithresh(A
,N
)thresh
a 1-by-N
vector containing
N
threshold values using Otsu’s method. You can use
thresh
as an input argument to imquantize
to convert image A
into an image with
N+1
discrete levels.
Examples
Input Arguments
Output Arguments
Algorithms
multithresh
finds the thresholds based on the aggregate histogram of
the entire image A
. multithresh
considers an RGB image
as a 3-D numeric array and computes the thresholds for the combined data from all three color
planes.
multithresh
uses the range of the input image A
,
[min(A(:)) max(A(:))]
, as the limits for computing the histogram used in
subsequent computations. multithresh
ignores any NaNs
in
computation. Any Infs
and -Infs
are counted in the first
and last bin of the histogram, respectively.
For degenerate inputs where the number of unique values in A
is less
than or equal to N
, there is no viable solution using Otsu's method. For
such inputs, the return value thresh
contains all the unique values from
A
and possibly some extra values that are chosen arbitrarily.
References
[1] Otsu, N., "A Threshold Selection Method from Gray-Level Histograms," IEEE Transactions on Systems, Man, and Cybernetics, Vol. 9, No. 1, 1979, pp. 62-66.
Extended Capabilities
Version History
Introduced in R2012b