ImFusion SDK 4.3
ImageTemplate Class Reference

#include <ImFusion/Base/ImageTemplate.h>

Class representing a template for extracting image content based on named reference regions. More...

Detailed Description

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< SharedImageSetsave () 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 &region, 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< ImageTemplateclone () const
 

Public Attributes

std::string m_name
 
std::unique_ptr< MemImagem_image
 
std::vector< Regionm_regions
 
Metric m_metric
 
double m_scale
 

Member Enumeration Documentation

◆ Metric

enum class Metric
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)

Member Function Documentation

◆ match()

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).

◆ matchRegion()

double matchRegion ( const Region & region,
const MemImage & targetImage ) const

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).


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close