← back to roto on ba3a.dev

Hysteresis

object Hysteresis

Two-level thresholding. A pixel at or above high is certainly foreground; one at or above low is foreground only when it connects, through all eight neighbours, to a certain one. So the soft edge of the figure is kept while equally faint noise elsewhere in the frame is not.

Functions

Link copied to clipboard
fun threshold(width: Int, height: Int, values: DoubleArray, low: Double, high: Double): Mask

Thresholds values, a row-major width × height map such as a colour difference.