![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Base/ImageTemplate.h>
Class representing a template for extracting image content based on named reference regions. More...
Class representing a template for extracting image content based on named reference regions.
Classes | |
struct | Region |
Public Types | |
enum class | Metric { L1 , Welsch , Cauchy } |
Define the metric used to measure pixel distance. Image values (x and y) are scaled in range [0, 1] and s is the scale. More... | |
Public Member Functions | |
ImageTemplate (const ImageTemplate &other) | |
ImageTemplate (Metric metric=Metric::L1, double scale=1.0) | |
Creates an empty template. | |
ImageTemplate (std::unique_ptr< MemImage > image, Metric metric=Metric::L1, double scale=1.0) | |
Creates a new template from image. | |
bool | operator== (const ImageTemplate &other) const |
Compares name, regions, and the pointer value for image (does not do actual image comparison) | |
void | load (std::unique_ptr< SharedImageSet > sis) |
Loads the template from a SharedImageSet (with name and regions). | |
std::unique_ptr< SharedImageSet > | save () const |
Saves the template to a SharedImageSet (with name and regions). | |
double | match (const MemImage &targetImage) const |
Matches the image template onto the target image. | |
double | matchRegion (const Region ®ion, const MemImage &targetImage) const |
Matches the image template onto the target image. | |
void | addRegion (Region region) |
void | setMetric (Metric metric) |
void | setMetricScale (double scale) |
std::unique_ptr< ImageTemplate > | clone () const |
Public Attributes | |
std::string | m_name |
std::unique_ptr< MemImage > | m_image |
std::vector< Region > | m_regions |
Metric | m_metric |
double | m_scale |
|
strong |
Define the metric used to measure pixel distance. Image values (x and y) are scaled in range [0, 1] and s
is the scale.
Enumerator | |
---|---|
Welsch | d(x, y) = |x - y| |
Cauchy | d(x, y) = 1 - exp(-1/2 * ((x-y)/s)^2) d(x, y) = log(1/2 * ((x-y)/s)^2 + 1) |
double match | ( | const MemImage & | targetImage | ) | const |
Matches the image template onto the target image.
Returns the similarity between each region in the template and the same region in the target. Both images must have the same size (otherwise, 0 is returned).
Matches the image template onto the target image.
Returns the similarity between the two only in the region passed as argument. Both images must have the same size (otherwise, 0 is returned).