Back to Adaptive Vision Studio website

You are here: Start » Filter Reference » Image Analysis » CompareGoldenTemplate_Edges

CompareGoldenTemplate_Edges


Compares image edges with the edges of a perfect template. Significant differences are considered defects.

Name Type Range Description
inImage Image Input image
inGoldenTemplate EdgeGoldenTemplate Golden edge template containing image with no defects
inGoldenTemplateAlignment CoordinateSystem2D Adjusts the golden template to the position of the inspected object
inStdDevX Real 0.0 - Amount of horizontal smoothing used by the edge filter
inStdDevY Real* 0.0 - Amount of vertical smoothing used by the edge filter (Auto = inStdDevX)
inEdgeThreshold Real 0.0 - Sufficient edge strength; edges of that strength will always be detected on the input image
inEdgeHysteresis Real 0.0 - Value by which the edge threshold is decreased for edge points neighboring with sufficiently strong edges
inMaxDistance Integer 0 - Maximal allowed distance between corresponding edges on the input and golden image
outDefects Region Region of detected defects
outDefectsPresent Bool Flag indicating whether any defects were detected
outMissingEdges Region Edges present on the golden image that are missing on the input image
outExcessiveEdges Region Edges that are not present on the golden image
outImageEdges Region Edges on the input image
outGoldenEdges Region Edges on the golden image
outMatchingEdges Region Golden edges present on the input image
outObjectPosition Rectangle2D Position of the object being compared

Applications

Finding general object defects by analyzing missing or excessive edges.

Description

This filter compares edges given input image with an image stored in a golden template and then, as a result, creates a region containing only pixels where edges are different.

This method is especially useful for finding defects of the object shape. Due to invulnerability to color changes, it may be used in appliances with changing light conditions.

Parameter inMaxDistance defines the maximal distances of two edges that should be treated as the same edge.

To prepare image and area to be compared in it you can use CreateGoldenTemplate_Edges filter or property window.

Mostly the inEdgeThreshold and inEdgeHysteresis parameters should have the same value as in CreateGoldenTemplate_Edges filter. The values should be changed however if the brightness of the input image is significantly different from the brightness of the golden image used in CreateGoldenTemplate_Edges. The inEdgeThreshold can be also decreased slightly if one wants to concentrate on missing edges or increased to concentrate on excessive edges.

More information about this technique can be found in Machine Vision Guide: Golden Template.

Hints

  • A golden template comparison filter should be preceded with filters finding the object in certain location. Most typically we do this with LocateSingleObject_Edges filter.
  • Connect the inImage input with the image containing the object.
  • Select an image with a perfect object and use it to create golden template using the CreateGoldenTemplate_Edges filter.
  • Set inEdgeThreshold, inEdgeHysteresis, inStdDevX and inStdDevY as in DetectEdges_AsRegion filter. These will control detection of the edges used for object comparison.
  • Set inMaxDistance to specify the maximum spatial deviation between the edges on the input image and the edges on the template.

Examples

Description of usage of this filter can be found in examples and tutorial: Comparing Golden Template, Basic golden template usage.

Remarks

Due to performance, it is recommended to create a template using the CreateGoldenTemplate_Edges filter outside a main loop of a program. It will create a model only once, instead of each iteration.

Errors

This filter can throw an exception to report error. Read how to deal with errors in Error Handling.

List of possible exceptions:

Error type Description
DomainError No valid golden template on input in CompareGoldenTemplate_Edges.

Complexity Level

This filter is available on Basic Complexity Level.

Filter Group

This filter is member of CompareGoldenTemplate filter group.

See Also