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
aandbby more thantoleranceon any RGB channel. Differing dimensions count as fully changed (1.0); two empty frames are unchanged (0.0).