Back to Adaptive Vision Library website

You are here: Start » Function Reference » Image Analysis » AvsFilter_CompareGoldenTemplate_Edges

AvsFilter_CompareGoldenTemplate_Edges


This is Filter Equivalent. This function may be present in generated code, but should not be used in hand-written code.

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

Syntax

void avl::AvsFilter_CompareGoldenTemplate_Edges
(
	CompareGoldenTemplate_EdgesState& ioState,
	const avl::Image& inImage,
	const avl::Image& inGoldenImage,
	atl::Optional<const avl::Region&> inRoi,
	bool inStaticModel,
	atl::real inStdDevX,
	atl::Optional<atl::real> inStdDevY,
	atl::real inEdgeThreshold,
	atl::real inEdgeHysteresis,
	int inMaxDistance,
	avl::Region& outDefects,
	bool& outDefectsPresent,
	avl::Region& outMissingEdges,
	avl::Region& outExcessiveEdges,
	atl::Optional<avl::Region&> outImageEdges = atl::NIL,
	atl::Optional<avl::Region&> outGoldenEdges = atl::NIL,
	atl::Optional<avl::Region&> outMatchingEdges = atl::NIL
)

Parameters

Name Type Range Default Description
ioState CompareGoldenTemplate_EdgesState& Object used to maintain state of the function.
inImage const Image& Input image
inGoldenImage const Image& Reference image containing no defects
inRoi Optional<const Region&> NIL Range of pixels to be processed
inStaticModel bool True Flag indicating whether the model should be created only in the first iteration
inStdDevX real 0.0 - 2.0f Amount of horizontal smoothing used by the edge filter
inStdDevY Optional<real> 0.0 - NIL Amount of vertical smoothing used by the edge filter (Auto = inStdDevX)
inEdgeThreshold real 0.0 - 35.0f Sufficient edge strength; edges of that strength will always be detected
inEdgeHysteresis real 0.0 - 15.0f Value by which the edge threshold is decreased for edge points neighboring with sufficiently strong edges
inMaxDistance int 0 - 2 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 Optional<Region&> NIL Edges on the input image
outGoldenEdges Optional<Region&> NIL Edges on the golden image
outMatchingEdges Optional<Region&> NIL Golden edges present on the input image

Description

This filter compares edges found on two input images and 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 this same edge.

To compare only part of an image use the CropImageToRectangle filter. Golden Template image can be stored in Global Parameter.

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 and cropping it to an image where the location and the size of the object are fixed. Most typically we do this with LocateSingleObject_Edges and CropImageToRectangle filters.
  • Connect the inImage input with the image containing the object at fixed location and size. Make sure that this image is available (the program was previously run).
  • Select an image with a perfect object and copy it to the inGoldenImage input (usually we copy it from the output of the CropImageToRectangle filter). It is recommended to use a global parameter here.
  • 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.
  • Set inStaticModel to False only if the value on the inGoldenImage input changes over time.

Remarks

Input inStaticModel allows to compute comparison model in the first iteration of the filter execution. This option may speedup computation in time-critical appliances.

See Also