eVision Python API
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...

Public Member Functions

None __init__ (self)
 Creates an eVision.EObjectTemplateMatcher object.
None __init__ (self, eVision.EObjectTemplateMatcher other)
 Creates an eVision.EObjectTemplateMatcher object.
None Load (self, str path)
 Load the eVision.EObjectTemplateMatcher configuration.
None Load (self, eVision.ESerializer|None serializer)
 Load the eVision.EObjectTemplateMatcher configuration.
None Save (self, str path)
 Save the eVision.EObjectTemplateMatcher configuration.
None Save (self, eVision.ESerializer|None serializer)
 Save the eVision.EObjectTemplateMatcher configuration.
None BuildTemplate (self, eVision.EObjectSelection selection, eVision.EFrame frame)
 Set the reference template from a previous EasyObject coded image, an object selection or a list of known positions.
None BuildTemplate (self, eVision.EObjectSelection selection)
 Set the reference template from a previous EasyObject coded image, an object selection or a list of known positions.
None BuildTemplate (self, eVision.ECodedImage2 objects, eVision.EFrame frame)
 Set the reference template from a previous EasyObject coded image, an object selection or a list of known positions.
None BuildTemplate (self, eVision.ECodedImage2 objects)
 Set the reference template from a previous EasyObject coded image, an object selection or a list of known positions.
None BuildTemplate (self, list[eVision._eVision.EPoint] positions, eVision.EFrame frame)
 Set the reference template from a previous EasyObject coded image, an object selection or a list of known positions.
None BuildTemplate (self, list[eVision._eVision.EPoint] positions)
 Set the reference template from a previous EasyObject coded image, an object selection or a list of known positions.
None SortSelection (self, eVision.EObjectSelection selection)
 Align and match the given selection with the reference template.
None SortPositions (self, list[eVision._eVision.EPoint] positions)
 Align and match the given position array with the reference template.
bool Match (self, list[eVision._eVision.EPoint] positions)
 Align and match the given items with the reference template.
bool Match (self, list[eVision._eVision.EPoint] positions, eVision.EFrame frame)
 Align and match the given items with the reference template.
bool Match (self, eVision.EObjectSelection selection, eVision.EFrame frame)
 Align and match the given items with the reference template.
bool Match (self, eVision.EObjectSelection selection)
 Align and match the given items with the reference template.
eVision.EObjectSelection GetMatched (self, eVision.EObjectSelection selection, bool fromSelection)
 Returns the matched objects in the order in which they appear in the template.
eVision.EObjectSelection GetMatched (self, eVision.EObjectSelection selection)
 Returns the matched objects in the order in which they appear in the template.
list[eVision._eVision.EPoint] GetMatched (self, list[eVision._eVision.EPoint] positions, bool fromSelection)
 Returns the matched objects in the order in which they appear in the template.
list[eVision._eVision.EPoint] GetMatched (self, list[eVision._eVision.EPoint] positions)
 Returns the matched objects in the order in which they appear in the template.
eVision.EObjectSelection GetExtra (self, 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.
list[eVision._eVision.EPoint] GetExtra (self, list[eVision._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.
eVision.EObjectSelection GetMissing (self, eVision.EObjectSelection templateSelection)
 Returns the template objects that were not matched, in the order in which they appeared in the template.
list[eVision._eVision.EPoint] GetMissing (self, list[eVision._eVision.EPoint] templatePositions)
 Returns the template objects that were not matched, in the order in which they appeared in the template.
None GetUnpairedObjects (self, list[int] onlyInTemplate, list[int] onlyInSelection)
 Return lists of object indexes that appear only in template or only in selection.
bool EnableAlignment (self)
 Enable an optional preliminary global alignement (rigid transformation only: translation and rotation).
 EnableAlignment (self, bool value)
 Enable an optional preliminary global alignement (rigid transformation only: translation and rotation).
eVision.EObjectTemplateMatcherAlignment Alignment (self)
 Sets optional preliminary alignement (rigid transformation only: translation and rotation).
 Alignment (self, eVision.EObjectTemplateMatcherAlignment value)
 Sets optional preliminary alignement (rigid transformation only: translation and rotation).
float MaximumAngle (self)
 When eVision.EObjectTemplateMatcher.Alignment is set to eVision.EObjectTemplateMatcherAlignment.Fast or eVision.EObjectTemplateMatcherAlignment.Robust, the alignment can be constrained to a given angle range.
 MaximumAngle (self, float value)
 When eVision.EObjectTemplateMatcher.Alignment is set to eVision.EObjectTemplateMatcherAlignment.Fast or eVision.EObjectTemplateMatcherAlignment.Robust, the alignment can be constrained to a given angle range.
float MaximumDistance (self)
 Defines the absolute maximum distance (in pixels) for a match to be valid.
 MaximumDistance (self, float value)
 Defines the absolute maximum distance (in pixels) for a match to be valid.
list[int] TemplateIndexes (self)
 For each object in the SELECTION return the paired index in the TEMPLATE.
list[int] SelectionIndexes (self)
 For each object in the TEMPLATE return the paired index in the SELECTION.
int NumberOfPairedObjects (self)
 Return the number of paired objects.

Detailed Description

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

Remarks:

License(s): EasyObject

Constructor & Destructor Documentation

◆ __init__() [1/2]

None eVision.EObjectTemplateMatcher.__init__ ( self)

Creates an eVision.EObjectTemplateMatcher object.

◆ __init__() [2/2]

None eVision.EObjectTemplateMatcher.__init__ ( self,
eVision.EObjectTemplateMatcher other )

Creates an eVision.EObjectTemplateMatcher object.

Parameters
otherReference to the eVision.EObjectTemplateMatcher used for the initialization.

Member Function Documentation

◆ Alignment() [1/2]

eVision.EObjectTemplateMatcherAlignment eVision.EObjectTemplateMatcher.Alignment ( self)

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 eVision.EObjectTemplateMatcherAlignment. The max rotation of the alignment can be set by eVision.EObjectTemplateMatcher.MaximumAngle. By default, no alignment is performed.

◆ Alignment() [2/2]

eVision.EObjectTemplateMatcher.Alignment ( self,
eVision.EObjectTemplateMatcherAlignment value )

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 eVision.EObjectTemplateMatcherAlignment. The max rotation of the alignment can be set by eVision.EObjectTemplateMatcher.MaximumAngle. By default, no alignment is performed.

◆ BuildTemplate() [1/6]

None eVision.EObjectTemplateMatcher.BuildTemplate ( self,
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() [2/6]

None eVision.EObjectTemplateMatcher.BuildTemplate ( self,
eVision.ECodedImage2 objects,
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() [3/6]

None eVision.EObjectTemplateMatcher.BuildTemplate ( self,
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() [4/6]

None eVision.EObjectTemplateMatcher.BuildTemplate ( self,
eVision.EObjectSelection selection,
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.

◆ BuildTemplate() [5/6]

None eVision.EObjectTemplateMatcher.BuildTemplate ( self,
list[eVision._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() [6/6]

None eVision.EObjectTemplateMatcher.BuildTemplate ( self,
list[eVision._eVision.EPoint] positions,
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.

◆ EnableAlignment() [1/2]

bool eVision.EObjectTemplateMatcher.EnableAlignment ( self)

Enable an optional preliminary global alignement (rigid transformation only: translation and rotation).

Enable alignment only if the selection is not aligned with the template.

◆ EnableAlignment() [2/2]

eVision.EObjectTemplateMatcher.EnableAlignment ( self,
bool value )

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 ( self,
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.

eVision.EObjectTemplateMatcher.Match must be called before this method.

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

◆ GetExtra() [2/2]

list[eVision._eVision.EPoint] eVision.EObjectTemplateMatcher.GetExtra ( self,
list[eVision._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.

eVision.EObjectTemplateMatcher.Match must be called before this method.

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

◆ GetMatched() [1/4]

eVision.EObjectSelection eVision.EObjectTemplateMatcher.GetMatched ( self,
eVision.EObjectSelection selection )

Returns the matched objects in the order in which they appear in the template.

eVision.EObjectTemplateMatcher.Match must be called before this method.

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

◆ GetMatched() [2/4]

eVision.EObjectSelection eVision.EObjectTemplateMatcher.GetMatched ( self,
eVision.EObjectSelection selection,
bool fromSelection )

Returns the matched objects in the order in which they appear in the template.

eVision.EObjectTemplateMatcher.Match must be called before this method.

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

◆ GetMatched() [3/4]

list[eVision._eVision.EPoint] eVision.EObjectTemplateMatcher.GetMatched ( self,
list[eVision._eVision.EPoint] positions )

Returns the matched objects in the order in which they appear in the template.

eVision.EObjectTemplateMatcher.Match must be called before this method.

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

◆ GetMatched() [4/4]

list[eVision._eVision.EPoint] eVision.EObjectTemplateMatcher.GetMatched ( self,
list[eVision._eVision.EPoint] positions,
bool fromSelection )

Returns the matched objects in the order in which they appear in the template.

eVision.EObjectTemplateMatcher.Match must be called before this method.

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

◆ GetMissing() [1/2]

eVision.EObjectSelection eVision.EObjectTemplateMatcher.GetMissing ( self,
eVision.EObjectSelection templateSelection )

Returns the template objects that were not matched, in the order in which they appeared in the template.

eVision.EObjectTemplateMatcher.Match must be called before this method.

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

◆ GetMissing() [2/2]

list[eVision._eVision.EPoint] eVision.EObjectTemplateMatcher.GetMissing ( self,
list[eVision._eVision.EPoint] templatePositions )

Returns the template objects that were not matched, in the order in which they appeared in the template.

eVision.EObjectTemplateMatcher.Match must be called before this method.

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

◆ GetUnpairedObjects()

None eVision.EObjectTemplateMatcher.GetUnpairedObjects ( self,
list[int] onlyInTemplate,
list[int] onlyInSelection )

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]

None eVision.EObjectTemplateMatcher.Load ( self,
eVision.ESerializer | None serializer )

Load the eVision.EObjectTemplateMatcher configuration.

The given eVision.ESerializer must have been created for reading.

Parameters
serializerThe serializer.

◆ Load() [2/2]

None eVision.EObjectTemplateMatcher.Load ( self,
str path )

Load the eVision.EObjectTemplateMatcher configuration.

The given eVision.ESerializer must have been created for reading.

Parameters
pathThe file path.

◆ Match() [1/4]

bool eVision.EObjectTemplateMatcher.Match ( self,
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 eVision.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 ( self,
eVision.EObjectSelection selection,
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 eVision.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 ( self,
list[eVision._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 eVision.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 ( self,
list[eVision._eVision.EPoint] positions,
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 eVision.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.

◆ MaximumAngle() [1/2]

float eVision.EObjectTemplateMatcher.MaximumAngle ( self)

When eVision.EObjectTemplateMatcher.Alignment is set to eVision.EObjectTemplateMatcherAlignment.Fast or eVision.EObjectTemplateMatcherAlignment.Robust, the alignment can be constrained to a given angle range.

This is useful to filter out symmetries and makes eVision.EObjectTemplateMatcherAlignment.Robust faster. Defaults to 180°.

◆ MaximumAngle() [2/2]

eVision.EObjectTemplateMatcher.MaximumAngle ( self,
float value )

When eVision.EObjectTemplateMatcher.Alignment is set to eVision.EObjectTemplateMatcherAlignment.Fast or eVision.EObjectTemplateMatcherAlignment.Robust, the alignment can be constrained to a given angle range.

This is useful to filter out symmetries and makes eVision.EObjectTemplateMatcherAlignment.Robust faster. Defaults to 180°.

◆ MaximumDistance() [1/2]

float eVision.EObjectTemplateMatcher.MaximumDistance ( self)

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.

◆ MaximumDistance() [2/2]

eVision.EObjectTemplateMatcher.MaximumDistance ( self,
float value )

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.

◆ NumberOfPairedObjects()

int eVision.EObjectTemplateMatcher.NumberOfPairedObjects ( self)

Return the number of paired objects.

◆ Save() [1/2]

None eVision.EObjectTemplateMatcher.Save ( self,
eVision.ESerializer | None serializer )

Save the eVision.EObjectTemplateMatcher configuration.

The given eVision.ESerializer must have been created for writing.

Parameters
serializerThe eVision.ESerializer object that is written to.

◆ Save() [2/2]

None eVision.EObjectTemplateMatcher.Save ( self,
str path )

Save the eVision.EObjectTemplateMatcher configuration.

The given eVision.ESerializer must have been created for writing.

Parameters
pathThe file path.

◆ SelectionIndexes()

list[int] eVision.EObjectTemplateMatcher.SelectionIndexes ( self)

For each object in the TEMPLATE return the paired index in the SELECTION.

if the object has no match, the value -1 is used.

◆ SortPositions()

None eVision.EObjectTemplateMatcher.SortPositions ( self,
list[eVision._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 eVision.EObjectTemplateMatcher.TemplateIndexes. The position indexes for template's positions are returned by method eVision.EObjectTemplateMatcher.SelectionIndexes. Indexes of positions that appears only in template or only in the given array are returned by method eVision.EObjectTemplateMatcher.GetUnpairedObjects. The complexity is O(n) where n is the number of elements in the given array.

Deprecated

Use eVision.EObjectTemplateMatcher.Match instead.

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

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

◆ SortSelection()

None eVision.EObjectTemplateMatcher.SortSelection ( self,
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 eVision.EObjectTemplateMatcher.TemplateIndexes.

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

Deprecated

Use eVision.EObjectTemplateMatcher.Match instead.

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

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

◆ TemplateIndexes()

list[int] eVision.EObjectTemplateMatcher.TemplateIndexes ( self)

For each object in the SELECTION return the paired index in the TEMPLATE.

If the object has no match, the value -1 is used.