multithresh
R2026bMultilevel image thresholds using Otsu’s method
Description
calculates a single threshold thresh = multithresh(I)thresh from grayscale image
I, using Otsu's method [1]. Otsu's method chooses a threshold that
minimizes the intraclass variance of the thresholded pixels.
You can use the threshold thresh with the imquantize function to convert a grayscale image to a two-level image.
returns multilevel image thresholds thresh = multithresh(I,N)thresh for N
threshold values.
You can use the threshold thresh with the imquantize function to convert a grayscale image 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 I. 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 I,
[min(I(:)) max(I(:))], 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 I 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
I 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








