visual-cortex-vision 0.10.0

Detectors for visual-cortex: pixel/color conditions, template matching, the OcrEngine contract, and OCR text parsers.
Documentation
use std::sync::Arc;

use visual_cortex_capture::{Frame, FrameView};

use crate::detector::DetectorError;

/// 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.
///
/// Preprocessors run every tick on the async path — they must be cheap
/// (block math, copies), never heavy inference.
pub trait Preprocessor: Send + 'static {
    fn process(&mut self, view: &FrameView<'_>) -> Result<Arc<Frame>, DetectorError>;

    /// Called once at subscribe time with the watcher's name, so stages
    /// with debug output can label their artifacts. Default: ignore.
    fn set_label(&mut self, _label: &str) {}
}