template-matching

Latest version Documentation MIT

GPU-accelerated template matching library for Rust. The crate is designed as a faster alternative to imageproc::template_matching.

Installation

bash [dependencies] template-matching = { version = "0.1.0", features = ["image"] }

Usage

```rust use templatematching::{findextremes, match_template, MatchTemplateMethod, TemplateMatcher};

fn main() { // Load images and convert them to f32 grayscale let inputimage = image::loadfrommemory(includebytes!("input.png")).unwrap().toluma32f(); let templateimage = image::loadfrommemory(includebytes!("template.png")).unwrap().toluma32f();

let result = match_template(&input_image, &template_image, MatchTemplateMethod::SumOfSquaredDifferences);

// Or alternatively you can create the matcher first
let matcher = TemplateMatcher::new();
let result = matcher.match_template(&input_image, &template_image, MatchTemplateMethod::SumOfSquaredDifferences);

// Calculate min & max values
let extremes = find_extremes(&result);

} ```