在matlab的image processing工具箱中,大津(Ostu)阈值分割方法有现成的函数实现 graythreshold
GRAYTHRESH Global image threshold using Otsu's method.
LEVEL = GRAYTHRESH(I) computes 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].
GRAYTHRESH uses Otsu's method, which chooses the threshold to minimize
the intraclass variance of the thresholded black and white pixels.
[LEVEL EM] = GRAYTHRESH(I) returns effectiveness metric, EM, as the
second output argument. It indicates the effectiveness of thresholding
of the input image and it is in the range [0, 1]. The lower bound is
attainable only by images having a single gray level, and the upper
bound is attainable only by two-valued images.
Class Support
----------