← back to roto on ba3a.dev

ForegroundMask

class ForegroundMask(plate: Raster, settings: MaskSettings)

Masks frames against one clean plate:

  1. the difference of each pixel from the plate in OKLab, its lightness part weighted down;

  2. Hysteresis between the low and high thresholds;

  3. Morphology opening, then closing;

  4. only the largest region, the figure;

  5. its holes filled, so a shirt the colour of the wall stays solid.

The plate's OKLab coordinates are computed once, here, and shared by every frame.

Constructors

Link copied to clipboard
constructor(plate: Raster, settings: MaskSettings)

Functions

Link copied to clipboard

Each pixel's weighted OKLab distance from the plate, row-major.

Link copied to clipboard
fun of(frame: Raster): Mask

The figure in frame, which must be the plate's size.