Back to Aurora Vision Studio website

You are here: Start » Filter Reference » Computer Vision » Template Matching » CreateEdgeModel2


Module: MatchingPro

Creates a model for edge-based template matching.


Dynamic creation of models in the runtime environment (normally they are created interactively in Studio).
Name Type Range Description
Input value
inImage Image Image from which model will be extracted
Input value
inTemplateRegion Region* Region of the image from which model will be extracted
Input value
inReferenceFrame Rectangle2D* Exact position of the model object in the image
Input value
inMinPyramidLevel Integer 0 - 12 Defines the number of reduced resolution levels dynamically created during model creation
Input value
inMaxPyramidLevel Integer* 0 - 12 Defines the number of reduced resolution levels used to speed up computations
Input value
inSmoothingStdDev Real 0.0 - Standard deviation of the gaussian smoothing applied before edge extraction
Input value
inEdgeThreshold Real 0.0 - Higher threshold for edge magnitude
Input value
inEdgeHysteresis Real 0.0 - Threshold hysteresis value for edge magnitude
Input value
inMinAngle Real Start of range of possible rotations
Input value
inMaxAngle Real End of range of possible rotations
Input value
inAnglePrecision Real 0.001 - 10.0 Defines angular resolution of the matching process
Input value
inMinScale Real 0.0 - Start of range of possible scales
Input value
inMaxScale Real 0.0 - End of range of possible scales
Input value
inScalePrecision Real 0.001 - 10.0 Defines scale resolution of the matching process
Input value
inEdgeCompleteness Real 0.01 - 1.0 Determines what fraction of the edges will be present in the created model
Output value
outEdgeModel EdgeModel2? Created model that can be used by LocateMultipleObjects_Edges
Output value
outEdgeModelPoint Point2D? The middle point of the created model
Output value
outEdges PathArray? Visualization of the model edges found at the original resolution
Diagnostic input
diagEdgePyramid ImageArray? Visualization of the edges found at different resolution levels


The operation creates an Edge-based Template Matching model for the object represented in inTemplateRegion region in inImage image. The resulting model can be matched against any image using the LocateSingleObject_Edges2 or LocateMultipleObjects_Edges2 filter.

The model consists of a pyramid of iteratively downsampled images, the original image being the first of them. The inMaxPyramidLevel parameter determines how many additional images of the pyramid shall be computed. Its value has great influence on computation speed. Therefore it is highly recommended to set its value as high as possible, at the same time ensuring that the model edges are at least 2^inMaxPyramidLevel pixels far from the inImage image frame. However, if it is set too high and no model edges are found on some pyramid level, an error with appropriate description occurs.

The inMinPyramidLevel parameter determines what is the lowest pyramid level that is generated in the filter. Each level lower than that will be generated on demand in a locating objects filter that uses the model.

The inEdgeThreshold and inEdgeHysteresis parameters control the hysteresis threshold (as in ThresholdImage_Hysteresis) used in the edge extraction (as in DetectEdges_AsRegion) phase of the model creation. It is an important part of using the filter to set these parameters properly, because only found edge pixels determine how good the later matching process will be. Therefore the outEdges and diagEdgePyramid are the crucial parameters for experiments, because they show found edges in the model image and edge pixels found at different resolution levels, respectively.

The inMinAngle and inMaxAngle parameters describe possible rotation angles of the model, i.e. only those object occurrences will be later found by LocateMultipleObjects_Edges2 whose rotation angles are in the range <inMinAngle,inMaxAngle>. The inAnglePrecision parameter controls the angular resolution of the matching process. The model is created in several rotations. The angles of consecutive rotations differ by an angle step from each other. The value of this angle step is determined on the basis of inAnglePrecision. Its value represents the multiplicity of the automatically computed angle step used as an actual step. So the greater inAnglePrecision is, the greater accuracy can be achieved and the lower is the chance of missing object occurrences. In practice however increasing inAnglePrecision above a certain threshold (unique for every object) does not increase the accuracy, only the computation time.

The inReferenceFrame is a characteristic rectangle, the position of which will be returned by LocateMultipleObjects_Edges2 as an occurrence of the object. By default, it is set to the bounding box of the edges found in inTemplateRegion.


Read more about Local Coordinate Systems in Machine Vision Guide: Local Coordinate Systems.

Additional information about Template Matching can be found in Machine Vision Guide: Template Matching

Hardware Acceleration

This operation supports automatic parallelization for multicore and multiprocessor systems.

Complexity Level

This filter is available on Advanced Complexity Level.

See Also