Global image threshold using Otsu's method
computes a
global threshold T = graythresh(I)T from grayscale image
I, using Otsu's method [1].
Otsu's method chooses a threshold that minimizes the intraclass variance of the
thresholded black and white pixels. The global threshold T
can be used with imbinarize to convert a
grayscale image to a binary image.
By default, the function imbinarize creates
a binary image using a threshold obtained using Otsu’s method.
This default threshold is identical to the threshold returned by graythresh.
However, imbinarize only returns the binary image.
If you want to know the level or the effectiveness metric, use graythresh before
calling imbinarize.
[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.