Start » Filter Reference » Computer Vision » Image Analysis » CompareGoldenTemplate_Edges

CompareGoldenTemplate_Edges


Module: FoundationPro

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

Applications

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

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

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