Expand description
CorrMatch is a CPU-first template matching library for grayscale images.
It provides a coarse-to-fine matcher with optional rotation search and
two metrics: ZNCC and SSD. The primary entry points are Template,
CompiledTemplate, and Matcher.
§Quick start
use corrmatch::{
CompileConfig, MatchConfig, Matcher, RotationMode, Template, ImageView,
};
let template = Template::new(tpl, tw, th)?;
let compiled = template.compile(CompileConfig::default())?;
let matcher = Matcher::new(compiled).with_config(MatchConfig {
rotation: RotationMode::Enabled,
..MatchConfig::default()
});
let image_view = ImageView::from_slice(image, width, height)?;
matcher.match_image(image_view)§Concepts
Template: owned template pixels.CompiledTemplate: precomputed template pyramid and (optionally) angle banks.Matcher: runs the coarse-to-fine search and returns the best match.CompiledTemplate::compile_unrotated: lightweight assets for translation-only matching.
§Data model
- Images and templates are grayscale
u8buffers in row-major order. ImageViewsupports explicit row stride; results report top-left coordinates at level 0.- Scores: ZNCC in roughly
[-1, 1], SSD reported as negative SSE (higher is better).
§Determinism
Matching is deterministic; enabling rayon via MatchConfig.parallel keeps results stable.
§Feature flags
rayon: parallel search execution.simd: SIMD-accelerated kernels (currently: unmasked translation-only path).image-io: file I/O helpers via theimagecrate.
§Low-level API
Advanced building blocks are available under corrmatch::lowlevel.
§CLI
A JSON-driven CLI lives in the corrmatch-cli workspace crate.
Modules§
- lowlevel
- Low-level building blocks for custom matching pipelines.
Structs§
- Compile
Config - Configuration for compiling template assets with rotation support.
- Compile
Config NoRot - Configuration for compiling template assets without rotation support.
- Image
Pyramid - Owned image pyramid built from a base level.
- Image
View - Borrowed 2D image view with an explicit stride.
- Match
- Match result for the finest pyramid level.
- Match
Config - Configuration for the coarse-to-fine matcher pipeline.
- Matcher
- Matcher that runs coarse-to-fine search using a compiled template.
- Owned
Image - Owned contiguous grayscale image buffer.
- Template
- Owned template image in contiguous grayscale format.
Enums§
- Compiled
Template - Compiled template assets for rotated or unrotated matching.
- Corr
Match Error - Errors that can occur when running corrmatch operations.
- Metric
- Matching metric selector.
- Rotation
Mode - Controls whether rotation is searched.
Type Aliases§
- Corr
Match Result - Result alias for corrmatch operations.