Compute global image threshold using Otsu's method.
The output level is a global threshold (level) that can be used to convert an intensity image to a binary image with
im2bw
. level is a normalized intensity value that lies in the range [0, 1].The function uses Otsu's method, which chooses the threshold to minimize the intraclass variance of the black and white pixels.
Color images are converted grayscale before level is computed.
See also: im2bw