class Threshold -- Threshold 物件

Threshold 物件是由 histogram.get_threshold() 回傳的 attrtuple。它會回報底層 Histogram 中每個通道的 Otsu 最佳分割值,亦即最能將該通道分為「背景」與「前景」兩半的區間值。

對於灰階直方圖,請使用 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]