Skip to main content

Crate rpa_vision

Crate rpa_vision 

Source
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

FeatureEnablesExtra system requirement
template-match (default)NCC matching
asyncfind_async, wait_for_match, wait_for_difftokio runtime
ocr[ocr::OcrEngine]Tesseract + language data
mlML detectionONNX 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;

Modules§

diff
prepared
template_match
types

Functions§

load_rgba
Load an image file as RGBA8.
save_rgba
Save an RGBA8 image to a file.