Expand description
Detectors: the Detector trait, built-in gates, and the OcrEngine trait.
Modules§
- filters
- Stock span filters for OCR detectors. A filter returns
trueto KEEP a span (likeIterator::filter); filtered spans are removed BEFORE change detection, so noise (a flickering button glyph) cannot fire spuriousChangedevents. - patterns
- Text parsers for OCR output. Used with
WatcherBuilder::ocr.
Structs§
- Brightness
- Mean luma (0.0..=255.0) of the region, as
DetectorOutput::Number. Pair with.on_threshold(...)for “screen went dark”-style watchers. - Color
Dominance - Boolean detector/gate: at least
min_fractionof pixels are dominated by one channel (e.g. “the HP bar area is mostly red”). - Color
Match - Boolean detector/gate: at least
min_fractionof the region’s pixels are withintolerance(per channel) of the target RGB color. - FnDetector
- Adapt a closure into a
Detector. Seefrom_fn. - Frame
Diff - Boolean gate: did the region’s pixels change since the last evaluation? Hashes the region’s bytes; the first evaluation always reports changed.
- OcrDetector
- PngDump
- PNG stills per sampled tick:
<dir>/<watcher>/NNNNNN-{input,baseline,overlay,output}.png. - Stability
Mask - Temporal stability mask: passes through only newly-appeared, now-static overlays (item tooltips, dialogs); moving gameplay and the permanent scene render black. Kept blocks are byte-identical to the input. Tick it fast (5–10 Hz): the frame-diff gate downstream keeps detector cost unchanged while nothing changes.
- Template
Matcher - Grayscale normalized cross-correlation template matcher.
- Text
Span - One recognized text region.
bboxis relative to the evaluated view.
Enums§
- Channel
- A primary color channel, for
ColorDominance. - Debug
Stage - Which pipeline artifact a debug frame shows.
- Detector
Error - Detector
Output - What a detector produced this tick.
Traits§
- Debug
Sink - A tap receiving per-tick stage frames from a preprocessor (see
StabilityMask::debug_sink). - Detector
- Evaluates one region of one frame. Built-in detectors, gates, and user-defined detectors all implement this same trait.
- OcrEngine
- Pluggable OCR backend. The default ONNX/PaddleOCR implementation lives in
the
visual-cortex-ocr-onnxcrate; any engine can slot in here. Returning an empty vec means “no text present” and is not an error. - Preprocessor
- Transforms a watcher’s cropped view into the frame the rest of the pipeline sees. Runs BEFORE the implicit frame-diff gate, so a preprocessor whose output is static (e.g. a fully-suppressed stability mask) holds the detector at zero cost until its output actually changes.
Functions§
- from_fn
- Build a detector from a closure:
from_fn(|view| Ok(DetectorOutput::Bool(true))).