eVision C++ API 26.10.0-beta.2.dev
Loading...
Searching...
No Matches
eVision::EObjectTemplateMatcher Class Reference

The EObjectTemplateMatcher class is a tool designed to align and match the output of EasyObject to a reference template. More...

#include <eVision/EasyObject/EasyObject2/EObjectTemplateMatcher.h>

Collaboration diagram for eVision::EObjectTemplateMatcher:

Public Member Functions

 EObjectTemplateMatcher ()
 Creates an EObjectTemplateMatcher object.
 EObjectTemplateMatcher (const eVision::EObjectTemplateMatcher &other)
 Creates an EObjectTemplateMatcher object.
virtual ~EObjectTemplateMatcher () throw ()
eVision::EObjectTemplateMatcher & operator= (const eVision::EObjectTemplateMatcher &other)
 Assignment operator.
void Load (const std::string &path)
 Load the EObjectTemplateMatcher configuration. The given ESerializer must have been created for reading.
void Load (eVision::ESerializer *serializer)
 Load the EObjectTemplateMatcher configuration. The given ESerializer must have been created for reading.
void Save (const std::string &path)
 Save the EObjectTemplateMatcher configuration. The given ESerializer must have been created for writing.
void Save (eVision::ESerializer *serializer)
 Save the EObjectTemplateMatcher configuration. The given ESerializer must have been created for writing.
void BuildTemplate (eVision::EObjectSelection &selection, const eVision::EFrame &frame)
 Set the reference template from a previous EasyObject coded image, an object selection or a list of known positions.
void BuildTemplate (eVision::EObjectSelection &selection)
 Set the reference template from a previous EasyObject coded image, an object selection or a list of known positions.
void BuildTemplate (eVision::ECodedImage2 &objects, const eVision::EFrame &frame)
 Set the reference template from a previous EasyObject coded image, an object selection or a list of known positions.
void BuildTemplate (eVision::ECodedImage2 &objects)
 Set the reference template from a previous EasyObject coded image, an object selection or a list of known positions.
void BuildTemplate (const std::vector< eVision::EPoint > &positions, const eVision::EFrame &frame)
 Set the reference template from a previous EasyObject coded image, an object selection or a list of known positions.
void BuildTemplate (const std::vector< eVision::EPoint > &positions)
 Set the reference template from a previous EasyObject coded image, an object selection or a list of known positions.
void SortSelection (const eVision::EObjectSelection &selection)
 Align and match the given selection with the reference template.
void SortPositions (const std::vector< eVision::EPoint > &positions)
 Align and match the given position array with the reference template.
bool Match (const std::vector< eVision::EPoint > &positions)
 Align and match the given items with the reference template.
bool Match (const std::vector< eVision::EPoint > &positions, const eVision::EFrame &frame)
 Align and match the given items with the reference template.
bool Match (const eVision::EObjectSelection &selection, const eVision::EFrame &frame)
 Align and match the given items with the reference template.
bool Match (const eVision::EObjectSelection &selection)
 Align and match the given items with the reference template.
void SetEnableAlignment (bool align)
 Enable an optional preliminary global alignement (rigid transformation only: translation and rotation). Enable alignment only if the selection is not aligned with the template.
bool GetEnableAlignment () const
 Enable an optional preliminary global alignement (rigid transformation only: translation and rotation). Enable alignment only if the selection is not aligned with the template.
void SetAlignment (eVision::EObjectTemplateMatcherAlignment alignment)
 Sets optional preliminary alignement (rigid transformation only: translation and rotation). Choose to enable alignment only if the selection is not aligned with the template. Three types of alignment are possible. See EObjectTemplateMatcherAlignment. The max rotation of the alignment can be set by EObjectTemplateMatcher::SetMaximumAngle. By default, no alignment is performed.
eVision::EObjectTemplateMatcherAlignment GetAlignment () const
 Sets optional preliminary alignement (rigid transformation only: translation and rotation). Choose to enable alignment only if the selection is not aligned with the template. Three types of alignment are possible. See EObjectTemplateMatcherAlignment. The max rotation of the alignment can be set by EObjectTemplateMatcher::SetMaximumAngle. By default, no alignment is performed.
void SetMaximumAngle (float maxAngle)
 When EObjectTemplateMatcher::SetAlignment is set to EObjectTemplateMatcherAlignment::EObjectTemplateMatcherAlignment_Fast or EObjectTemplateMatcherAlignment::EObjectTemplateMatcherAlignment_Robust, the alignment can be constrained to a given angle range. This is useful to filter out symmetries and makes EObjectTemplateMatcherAlignment::EObjectTemplateMatcherAlignment_Robust faster. Defaults to 180°.
float GetMaximumAngle () const
 When EObjectTemplateMatcher::SetAlignment is set to EObjectTemplateMatcherAlignment::EObjectTemplateMatcherAlignment_Fast or EObjectTemplateMatcherAlignment::EObjectTemplateMatcherAlignment_Robust, the alignment can be constrained to a given angle range. This is useful to filter out symmetries and makes EObjectTemplateMatcherAlignment::EObjectTemplateMatcherAlignment_Robust faster. Defaults to 180°.
void SetMaximumDistance (float distance)
 Defines the absolute maximum distance (in pixels) for a match to be valid. That value is used during the closest object search. By default, infinite distance is used.
float GetMaximumDistance () const
 Defines the absolute maximum distance (in pixels) for a match to be valid. That value is used during the closest object search. By default, infinite distance is used.
eVision::EObjectSelection GetMatched (const eVision::EObjectSelection &selection, bool fromSelection)
 Returns the matched objects in the order in which they appear in the template. EObjectTemplateMatcher::Match must be called before this method.
eVision::EObjectSelection GetMatched (const eVision::EObjectSelection &selection)
 Returns the matched objects in the order in which they appear in the template. EObjectTemplateMatcher::Match must be called before this method.
std::vector< eVision::EPoint > GetMatched (const std::vector< eVision::EPoint > &positions, bool fromSelection)
 Returns the matched objects in the order in which they appear in the template. EObjectTemplateMatcher::Match must be called before this method.
std::vector< eVision::EPoint > GetMatched (const std::vector< eVision::EPoint > &positions)
 Returns the matched objects in the order in which they appear in the template. EObjectTemplateMatcher::Match must be called before this method.
eVision::EObjectSelection GetExtra (const eVision::EObjectSelection &selection)
 Returns the objects in the selection that do not appear in the template, in the order in which they appear in the selection. EObjectTemplateMatcher::Match must be called before this method.
std::vector< eVision::EPoint > GetExtra (const std::vector< eVision::EPoint > &positions)
 Returns the objects in the selection that do not appear in the template, in the order in which they appear in the selection. EObjectTemplateMatcher::Match must be called before this method.
eVision::EObjectSelection GetMissing (const eVision::EObjectSelection &templateSelection)
 Returns the template objects that were not matched, in the order in which they appeared in the template. EObjectTemplateMatcher::Match must be called before this method.
std::vector< eVision::EPoint > GetMissing (const std::vector< eVision::EPoint > &templatePositions)
 Returns the template objects that were not matched, in the order in which they appeared in the template. EObjectTemplateMatcher::Match must be called before this method.
std::vector< int32_t > GetTemplateIndexes () const
 For each object in the SELECTION return the paired index in the TEMPLATE. If the object has no match, the value -1 is used.
std::vector< int32_t > GetSelectionIndexes () const
 For each object in the TEMPLATE return the paired index in the SELECTION. if the object has no match, the value -1 is used.
int32_t GetNumberOfPairedObjects () const
 Return the number of paired objects.
void GetUnpairedObjects (std::vector< int32_t > &onlyInTemplate, std::vector< int32_t > &onlyInSelection) const
 Return lists of object indexes that appear only in template or only in selection.
 EObjectTemplateMatcher (CppWrapperInternal::InternalConstructor)

Public Attributes

CppWrapperInternal::WrappedClass wrappedClass_

Detailed Description

The EObjectTemplateMatcher class is a tool designed to align and match the output of EasyObject to a reference template.

License(s): EasyObject

Constructor & Destructor Documentation

◆ EObjectTemplateMatcher() [1/3]

eVision::EObjectTemplateMatcher::EObjectTemplateMatcher ( )

Creates an EObjectTemplateMatcher object.

◆ EObjectTemplateMatcher() [2/3]

eVision::EObjectTemplateMatcher::EObjectTemplateMatcher ( const eVision::EObjectTemplateMatcher & other)

Creates an EObjectTemplateMatcher object.

Parameters
otherReference to the EObjectTemplateMatcher used for the initialization.

◆ ~EObjectTemplateMatcher()

eVision::EObjectTemplateMatcher::~EObjectTemplateMatcher ( )
throw ( )
virtual

◆ EObjectTemplateMatcher() [3/3]

eVision::EObjectTemplateMatcher::EObjectTemplateMatcher ( CppWrapperInternal::InternalConstructor )

Member Function Documentation

◆ BuildTemplate() [1/6]

void eVision::EObjectTemplateMatcher::BuildTemplate ( const std::vector< eVision::EPoint > & positions)

Set the reference template from a previous EasyObject coded image, an object selection or a list of known positions.

Parameters
positionsThe list of positions to be used as template.

◆ BuildTemplate() [2/6]

void eVision::EObjectTemplateMatcher::BuildTemplate ( const std::vector< eVision::EPoint > & positions,
const eVision::EFrame & frame )

Set the reference template from a previous EasyObject coded image, an object selection or a list of known positions.

Parameters
positionsThe list of positions to be used as template.
frameThe frame in which the other arguments are expressed.

◆ BuildTemplate() [3/6]

void eVision::EObjectTemplateMatcher::BuildTemplate ( eVision::ECodedImage2 & objects)

Set the reference template from a previous EasyObject coded image, an object selection or a list of known positions.

Parameters
objectsThe coded image to be used as template.

◆ BuildTemplate() [4/6]

void eVision::EObjectTemplateMatcher::BuildTemplate ( eVision::ECodedImage2 & objects,
const eVision::EFrame & frame )

Set the reference template from a previous EasyObject coded image, an object selection or a list of known positions.

Parameters
objectsThe coded image to be used as template.
frameThe frame in which the other arguments are expressed.

◆ BuildTemplate() [5/6]

void eVision::EObjectTemplateMatcher::BuildTemplate ( eVision::EObjectSelection & selection)

Set the reference template from a previous EasyObject coded image, an object selection or a list of known positions.

Parameters
selectionThe object selection to be used as template.

◆ BuildTemplate() [6/6]

void eVision::EObjectTemplateMatcher::BuildTemplate ( eVision::EObjectSelection & selection,
const eVision::EFrame & frame )

Set the reference template from a previous EasyObject coded image, an object selection or a list of known positions.

Parameters
selectionThe object selection to be used as template.
frameThe frame in which the other arguments are expressed.

◆ GetAlignment()

eVision::EObjectTemplateMatcherAlignment eVision::EObjectTemplateMatcher::GetAlignment ( ) const

Sets optional preliminary alignement (rigid transformation only: translation and rotation). Choose to enable alignment only if the selection is not aligned with the template. Three types of alignment are possible. See EObjectTemplateMatcherAlignment. The max rotation of the alignment can be set by EObjectTemplateMatcher::SetMaximumAngle. By default, no alignment is performed.

◆ GetEnableAlignment()

bool eVision::EObjectTemplateMatcher::GetEnableAlignment ( ) const

Enable an optional preliminary global alignement (rigid transformation only: translation and rotation). Enable alignment only if the selection is not aligned with the template.

◆ GetExtra() [1/2]

eVision::EObjectSelection eVision::EObjectTemplateMatcher::GetExtra ( const eVision::EObjectSelection & selection)

Returns the objects in the selection that do not appear in the template, in the order in which they appear in the selection. EObjectTemplateMatcher::Match must be called before this method.

Parameters
selectionThe object selection that was used in EObjectTemplateMatcher::Match.

◆ GetExtra() [2/2]

std::vector< eVision::EPoint > eVision::EObjectTemplateMatcher::GetExtra ( const std::vector< eVision::EPoint > & positions)

Returns the objects in the selection that do not appear in the template, in the order in which they appear in the selection. EObjectTemplateMatcher::Match must be called before this method.

Parameters
positionsThe vector of positions that was used in EObjectTemplateMatcher::Match.

◆ GetMatched() [1/4]

eVision::EObjectSelection eVision::EObjectTemplateMatcher::GetMatched ( const eVision::EObjectSelection & selection)

Returns the matched objects in the order in which they appear in the template. EObjectTemplateMatcher::Match must be called before this method.

Parameters
selectionThe object selection that was used in EObjectTemplateMatcher::Match.

◆ GetMatched() [2/4]

eVision::EObjectSelection eVision::EObjectTemplateMatcher::GetMatched ( const eVision::EObjectSelection & selection,
bool fromSelection )

Returns the matched objects in the order in which they appear in the template. EObjectTemplateMatcher::Match must be called before this method.

Parameters
selectionThe object selection that was used in EObjectTemplateMatcher::Match.
fromSelectionWether the given objects are from the selection or the template. Default: selection

◆ GetMatched() [3/4]

std::vector< eVision::EPoint > eVision::EObjectTemplateMatcher::GetMatched ( const std::vector< eVision::EPoint > & positions)

Returns the matched objects in the order in which they appear in the template. EObjectTemplateMatcher::Match must be called before this method.

Parameters
positionsThe vector of positions that was used in EObjectTemplateMatcher::Match.

◆ GetMatched() [4/4]

std::vector< eVision::EPoint > eVision::EObjectTemplateMatcher::GetMatched ( const std::vector< eVision::EPoint > & positions,
bool fromSelection )

Returns the matched objects in the order in which they appear in the template. EObjectTemplateMatcher::Match must be called before this method.

Parameters
positionsThe vector of positions that was used in EObjectTemplateMatcher::Match.
fromSelectionWether the given objects are from the selection or the template. Default: selection

◆ GetMaximumAngle()

float eVision::EObjectTemplateMatcher::GetMaximumAngle ( ) const

◆ GetMaximumDistance()

float eVision::EObjectTemplateMatcher::GetMaximumDistance ( ) const

Defines the absolute maximum distance (in pixels) for a match to be valid. That value is used during the closest object search. By default, infinite distance is used.

◆ GetMissing() [1/2]

eVision::EObjectSelection eVision::EObjectTemplateMatcher::GetMissing ( const eVision::EObjectSelection & templateSelection)

Returns the template objects that were not matched, in the order in which they appeared in the template. EObjectTemplateMatcher::Match must be called before this method.

Parameters
templateSelectionThe object selection that was used in EObjectTemplateMatcher::BuildTemplate.

◆ GetMissing() [2/2]

std::vector< eVision::EPoint > eVision::EObjectTemplateMatcher::GetMissing ( const std::vector< eVision::EPoint > & templatePositions)

Returns the template objects that were not matched, in the order in which they appeared in the template. EObjectTemplateMatcher::Match must be called before this method.

Parameters
templatePositionsThe vector of positions that was used in EObjectTemplateMatcher::BuildTemplate.

◆ GetNumberOfPairedObjects()

int32_t eVision::EObjectTemplateMatcher::GetNumberOfPairedObjects ( ) const

Return the number of paired objects.

◆ GetSelectionIndexes()

std::vector< int32_t > eVision::EObjectTemplateMatcher::GetSelectionIndexes ( ) const

For each object in the TEMPLATE return the paired index in the SELECTION. if the object has no match, the value -1 is used.

◆ GetTemplateIndexes()

std::vector< int32_t > eVision::EObjectTemplateMatcher::GetTemplateIndexes ( ) const

For each object in the SELECTION return the paired index in the TEMPLATE. If the object has no match, the value -1 is used.

◆ GetUnpairedObjects()

void eVision::EObjectTemplateMatcher::GetUnpairedObjects ( std::vector< int32_t > & onlyInTemplate,
std::vector< int32_t > & onlyInSelection ) const

Return lists of object indexes that appear only in template or only in selection.

Parameters
onlyInTemplateThe list of object indexes that appear only in the template.
onlyInSelectionThe list of object indexes that appear only in the selection.

◆ Load() [1/2]

void eVision::EObjectTemplateMatcher::Load ( const std::string & path)

Load the EObjectTemplateMatcher configuration. The given ESerializer must have been created for reading.

Parameters
pathThe file path.

◆ Load() [2/2]

void eVision::EObjectTemplateMatcher::Load ( eVision::ESerializer * serializer)

Load the EObjectTemplateMatcher configuration. The given ESerializer must have been created for reading.

Parameters
serializerThe serializer.

◆ Match() [1/4]

bool eVision::EObjectTemplateMatcher::Match ( const eVision::EObjectSelection & selection)

Align and match the given items with the reference template.

The shortest distance between the positions is used to pair the given positions with the template's positions. In the case of EObjectSelection, only the centers of the objects are considered.

After the execution of this function:

Returns true if all given objects and all template objects are matched.

Parameters
selectionThe object selection to be compared with the template.

◆ Match() [2/4]

bool eVision::EObjectTemplateMatcher::Match ( const eVision::EObjectSelection & selection,
const eVision::EFrame & frame )

Align and match the given items with the reference template.

The shortest distance between the positions is used to pair the given positions with the template's positions. In the case of EObjectSelection, only the centers of the objects are considered.

After the execution of this function:

Returns true if all given objects and all template objects are matched.

Parameters
selectionThe object selection to be compared with the template.
frameThe frame in which the other arguments are expressed.

◆ Match() [3/4]

bool eVision::EObjectTemplateMatcher::Match ( const std::vector< eVision::EPoint > & positions)

Align and match the given items with the reference template.

The shortest distance between the positions is used to pair the given positions with the template's positions. In the case of EObjectSelection, only the centers of the objects are considered.

After the execution of this function:

Returns true if all given objects and all template objects are matched.

Parameters
positionsThe array of positions to be compared with the template.

◆ Match() [4/4]

bool eVision::EObjectTemplateMatcher::Match ( const std::vector< eVision::EPoint > & positions,
const eVision::EFrame & frame )

Align and match the given items with the reference template.

The shortest distance between the positions is used to pair the given positions with the template's positions. In the case of EObjectSelection, only the centers of the objects are considered.

After the execution of this function:

Returns true if all given objects and all template objects are matched.

Parameters
positionsThe array of positions to be compared with the template.
frameThe frame in which the other arguments are expressed.

◆ operator=()

eVision::EObjectTemplateMatcher & eVision::EObjectTemplateMatcher::operator= ( const eVision::EObjectTemplateMatcher & other)

Assignment operator.

Parameters
otherThe EObjectTemplateMatcher object that should be copied.

◆ Save() [1/2]

void eVision::EObjectTemplateMatcher::Save ( const std::string & path)

Save the EObjectTemplateMatcher configuration. The given ESerializer must have been created for writing.

Parameters
pathThe file path.

◆ Save() [2/2]

void eVision::EObjectTemplateMatcher::Save ( eVision::ESerializer * serializer)

Save the EObjectTemplateMatcher configuration. The given ESerializer must have been created for writing.

Parameters
serializerThe ESerializer object that is written to.

◆ SetAlignment()

void eVision::EObjectTemplateMatcher::SetAlignment ( eVision::EObjectTemplateMatcherAlignment alignment)

Sets optional preliminary alignement (rigid transformation only: translation and rotation). Choose to enable alignment only if the selection is not aligned with the template. Three types of alignment are possible. See EObjectTemplateMatcherAlignment. The max rotation of the alignment can be set by EObjectTemplateMatcher::SetMaximumAngle. By default, no alignment is performed.

Parameters
alignmentThe type of alignment to apply.

◆ SetEnableAlignment()

void eVision::EObjectTemplateMatcher::SetEnableAlignment ( bool align)

Enable an optional preliminary global alignement (rigid transformation only: translation and rotation). Enable alignment only if the selection is not aligned with the template.

Parameters
alignA boolean value to enable or disable the global alignment.
Deprecated

Use EObjectTemplateMatcher::SetAlignment instead. This sets the alignment to EObjectTemplateMatcherAlignment::EObjectTemplateMatcherAlignment_Fast.

Deprecated in version 26.6. Scheduled to be removed in version 27.6.

◆ SetMaximumAngle()

void eVision::EObjectTemplateMatcher::SetMaximumAngle ( float maxAngle)

When EObjectTemplateMatcher::SetAlignment is set to EObjectTemplateMatcherAlignment::EObjectTemplateMatcherAlignment_Fast or EObjectTemplateMatcherAlignment::EObjectTemplateMatcherAlignment_Robust, the alignment can be constrained to a given angle range. This is useful to filter out symmetries and makes EObjectTemplateMatcherAlignment::EObjectTemplateMatcherAlignment_Robust faster. Defaults to 180°.

Parameters
maxAngleThe maximal alignment angle allowed. Allowed values are [0, 180°].

◆ SetMaximumDistance()

void eVision::EObjectTemplateMatcher::SetMaximumDistance ( float distance)

Defines the absolute maximum distance (in pixels) for a match to be valid. That value is used during the closest object search. By default, infinite distance is used.

Parameters
distanceThe Euclidean distance.

◆ SortPositions()

void eVision::EObjectTemplateMatcher::SortPositions ( const std::vector< eVision::EPoint > & positions)

Align and match the given position array with the reference template.

The shortest distance between the positions is used to pair the given positions with the template's positions. After the execution of this function, the template indexes corresponding to the position array are returned by method EObjectTemplateMatcher::GetTemplateIndexes. The position indexes for template's positions are returned by method EObjectTemplateMatcher::GetSelectionIndexes. Indexes of positions that appears only in template or only in the given array are returned by method EObjectTemplateMatcher::GetUnpairedObjects. The complexity is O(n) where n is the number of elements in the given array.

Parameters
positionsThe array of positions to be compared with the template.
Deprecated

Use EObjectTemplateMatcher::Match instead.

Deprecated in version 26.6. Scheduled to be removed in version 27.6.

◆ SortSelection()

void eVision::EObjectTemplateMatcher::SortSelection ( const eVision::EObjectSelection & selection)

Align and match the given selection with the reference template.

The shortest distance between object's centers is used to pair the objects in the selection with the objects in the template. After the execution of this function, the template indexes corresponding to selection objects are returned by method EObjectTemplateMatcher::GetTemplateIndexes.

The selection indexes for template objects are returned by method EObjectTemplateMatcher::GetSelectionIndexes. Indexes of objects that appears only in template or only in selection are returned by method EObjectTemplateMatcher::GetUnpairedObjects. The complexity is O(n) where n is the number of objects in selection.

Parameters
selectionThe object selection to be compared. The selection is unchanged.
Deprecated

Use EObjectTemplateMatcher::Match instead.

Deprecated in version 26.6. Scheduled to be removed in version 27.6.

Member Data Documentation

◆ wrappedClass_

CppWrapperInternal::WrappedClass eVision::EObjectTemplateMatcher::wrappedClass_