← back to roto on ba3a.dev

Package-level declarations

Types

Link copied to clipboard
@Serializable
enum BrushMode : Enum<BrushMode>

What a stroke does to the mask: paints figure in, or paints it out.

Link copied to clipboard
@Serializable
data class BrushPoint(val x: Int, val y: Int)

A point of a stroke, in working-frame pixels.

Link copied to clipboard
@Serializable
data class BrushStroke(val frame: Int, val mode: BrushMode, val radius: Int, val points: List<BrushPoint>)

One stroke of the artist's brush on frame of a clip's mask; stored per clip in profile.json, in the order painted. It stamps a disc of radius pixels along points, in working-frame pixels, and strokes on one frame apply in that order, so a later one wins where they cross.

Link copied to clipboard

Connected regions of a Mask. Foreground connects through all eight neighbours and background through the four edge neighbours — the usual pairing, so a diagonal chain of foreground pixels is one region and background never leaks through it.

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

Masks frames against one clean plate:

Link copied to clipboard

The mask stage: one ForegroundMask per frame of a clip, against the clip's clean plate. Cached under the frames, the plate and the MaskSettings, so changing a threshold masks again and nothing upstream is touched.

Link copied to clipboard
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.

Link copied to clipboard
object MaskBrush

Applies BrushStrokes to a mask: pure, so the same strokes always give the same mask.

Link copied to clipboard
class MaskFixer(cache: StageCache)

The mask fix stage: a clip's masks with the artist's BrushStrokes applied by MaskBrush, cached under the masks and the strokes. With no strokes it is the masks themselves, so an unfixed clip stores nothing twice and keeps every downstream key.

Link copied to clipboard
@Serializable
data class MaskSettings(val lightnessWeight: Double = 0.25, val low: Double = 0.045, val high: Double = 0.1, val openRadius: Int = 1, val closeRadius: Int = 2)

How a clip's figure is told apart from its clean plate; stored per clip in profile.json.

Link copied to clipboard
object Morphology

Binary morphology with a square structuring element of side 2 × radius + 1. A square is separable, so each operation runs along rows and then columns, with a sliding count that makes the cost independent of the radius.