← back to roto on ba3a.dev

NearestZone

Splits a figure into zones by nearest prototype. Every ZoneSample is one prototype: the mean OKLab colour of the 3×3 pixels around the click, so a single noisy pixel cannot decide it. Every masked pixel then takes the zone of the prototype nearest to it, its lightness weighted as the ZoneSettings say; of prototypes equally near, the first wins.

A label map holds 0 for background and i + 1 for the ith zone.

Types

Link copied to clipboard
data class Prototype(val label: Int, val color: OkLab)

A color the artist sampled, standing for the zone labelled label.

Functions

Link copied to clipboard
fun label(frame: Raster, mask: Mask, prototypes: List<NearestZone.Prototype>, lightnessWeight: Double): IndexedRaster

frame's label map: each pixel inside mask labelled with its nearest of prototypes.

Link copied to clipboard

The prototypes of settings' zones, sampled from frames, the clip's frames.