Skip to main content

Module diff

Module diff 

Source
Expand description

Frame-difference metric for change detection.

A dependency-free helper for the change monitor: how much did two captured frames differ? Pixels are compared on RGB only (captures force alpha to 255), and a per-pixel tolerance absorbs codec/dither noise so a blinking cursor or a one-bit jitter doesn’t read as a change.

Constants§

DEFAULT_TOLERANCE
A sensible default per-channel tolerance (out of 255): below this, two pixels are considered equal.

Functions§

changed_fraction
Fraction (0.0–1.0) of pixels that differ between a and b by more than tolerance on any RGB channel. Differing dimensions count as fully changed (1.0); two empty frames are unchanged (0.0).