Expand description
Multi-scale NCC template matching for desktop automation.
Finds a template image inside a screenshot using Normalized Cross-Correlation (NCC). Tolerates RDP compression artifacts, DPI scaling, and dynamic UI elements via mask regions.
§Quick start
use rpa_vision::{TemplateMatcher, ScreenPoint, load_rgba};
let haystack = load_rgba("screenshot.png").unwrap();
let template = load_rgba("button.png").unwrap();
let matcher = TemplateMatcher::default(); // threshold 0.87, multi-scale on
let result = matcher.find(&haystack, &template, ScreenPoint { x: 0, y: 0 }).unwrap();
println!("center={:?} score={:.3}", result.center, result.score);§Features
| Feature | Enables | Extra system requirement |
|---|---|---|
template-match (default) | NCC matching | — |
async | find_async, wait_for_match, wait_for_diff | tokio runtime |
ocr | [ocr::OcrEngine] | Tesseract + language data |
ml | ML detection | ONNX Runtime |
Re-exports§
pub use diff::diff;pub use diff::diff_in_region;pub use diff::DiffResult;pub use prepared::PreparedTemplate;pub use template_match::MatchError;pub use template_match::MatchResult;pub use template_match::Result;pub use template_match::TemplateMatcher;pub use types::MaskRegion;pub use types::Rect;pub use types::ScreenPoint;