class Threshold -- Threshold 对象

Threshold 对象是由 histogram.get_threshold() 返回的 attrtuple。它报告底层 Histogram 中每个通道的 Otsu 最优分割值——即能将该通道最佳地分为“背景”和“前景”两半的 bin 值。

对于灰度直方图,使用 value(其余三个字段为 0)。对于 RGB565 直方图,l_value / a_value / b_value 分别给出 LAB 的 LAB 通道的 Otsu 阈值。返回的值非常适合直接传入 Image.binary() 或任何其他接受 LAB 颜色阈值的方法。

可以通过属性名(threshold.value)或索引(threshold[0])访问字段。该对象没有公开的构造函数。

class image.threshold

请调用 histogram.get_threshold() 来创建此对象。

value

灰度 Otsu 阈值。整数 0 -- 255。索引 [0]

l_value

LAB L 通道 Otsu 阈值。整数 0 -- 100。索引 [1]

a_value

LAB A 通道 Otsu 阈值。整数 -128 -- 127。索引 [2]

b_value

LAB B 通道 Otsu 阈值。整数 -128 -- 127。索引 [3]