class Threshold – Threshold Object¶
The threshold object is an attrtuple returned by histogram.get_threshold(). It reports the Otsu-optimal split value for each channel of the underlying Histogram – i.e. the bin value that best separates the channel into a “background” and “foreground” half.
For grayscale histograms, use value (the other three fields are 0). For RGB565 histograms, l_value / a_value / b_value give the Otsu threshold for the LAB L, A, and B channels respectively. The returned values are well-suited to feed directly into Image.binary() or any other method that takes LAB color thresholds.
Fields are accessible by attribute name (threshold.value) or by index (threshold[0]). The object has no public constructor.
- class image.threshold¶
Please call
histogram.get_threshold()to create this object.- value¶
Grayscale Otsu threshold value. Integer 0 – 255. Index
[0].
- l_value¶
LAB
Lchannel Otsu threshold value. Integer 0 – 100. Index[1].
- a_value¶
LAB
Achannel Otsu threshold value. Integer -128 – 127. Index[2].
- b_value¶
LAB
Bchannel Otsu threshold value. Integer -128 – 127. Index[3].