Exhaustive#
Exhaustive template matching evaluates similarity along a provided set of rotations and all possible translations are sampled using Fast Fourier Transform (FFT) operations. Therefore, the algorithm is guaranteed to evaluate a provided set of configurations and to find a global optimum with a sufficiently high angular sampling rate.
Within pytme, exhaustive template matching is modularized into three primary stages: setup, scoring, and callback.
Setup: Creates a context where template matching is poised to be carried out efficiently. Setup functions involve data preparation, configuring FFT operations and pre-computing shared parameters.
Scoring: Sample scoring function across translational and rotational degrees of freedom.
Callback: Custom on the fly processing of template matching results using analyzers.
This concept is embodied in the scan
and scan_subsets
methods below.
If you wish to integrate custom template matching methods into pytme, please refer to the Adding Custom Methods section.
Methods#
scan_subsets
orchestrates the matching process, supporting parallel processing and post-scoring operations. scan_subsets
is a wrapper around scan
that enables template matching on data subsets, making it particularly useful for handling large datasets or targeting specific regions.
|
Run template matching. |
|
Wrapper around |
Setup functions#
|
Setup function for computing the unnormalized cross-correlation between |
|
Setup function for computing the laplace cross-correlation between |
|
Setup for computing a normalized cross-correlation between a |
|
Like |
|
Setup function for |
|
Like |
|
Setup function for |
Scoring functions#
|
Calculates a normalized cross-correlation between a target f and a template g. |
|
Computes a normalized cross-correlation between |
|
Computes a normalized cross-correlation score between |
Adding Custom Methods#
For a method to be considered by pytme’s template matching engine, it needs to be registered via register_matching_exhaustive()
. This enables developers to specify a unique name, setup function, scoring function, and a custom memory estimation class for their method. This ensures the modular and extensible design of pytme, allowing developers to continuously expand tme’s capabilities.
Adding a new template matching methods requires defining the following parameters:
matching
: Name of the matching method.matching_setup
: The setup function associated with the name.matching_scoring
: The scoring function associated with the name.memory_class
: A custom memory estimation class, which inherits fromMatchingMemoryUsage
|
Registers a new matching scheme. |