Back to FabImage Library website

You are here: Start » Function Reference » Computer Vision » Image Analysis » CreateGoldenTemplate_Edges

CreateGoldenTemplate_Edges


Header: FIL.h
Namespace: fil
Module: FoundationPro

Creates golden template for application in CompareGoldenTemplate_Edges filter.

Syntax

C++
C#
 
void fil::CreateGoldenTemplate_Edges
(
	const fil::Image& inTemplateImage,
	ftl::Optional<const fil::Rectangle2D&> inTemplateArea,
	ftl::Optional<const fil::Region&> inMask,
	ftl::Optional<const fil::CoordinateSystem2D&> inTemplateAreaAlignment,
	float inStdDevX,
	ftl::Optional<float> inStdDevY,
	float inEdgeThreshold,
	float inEdgeHysteresis,
	fil::EdgeGoldenTemplate& outGoldenTemplate,
	fil::Image& diagCroppedImage,
	fil::Region& diagCroppedEdges,
	fil::Region& diagEdges
)

Parameters

Name Type Range Default Description
Input value
inTemplateImage const Image& Template image containing an object with no defects
Input value
inTemplateArea Optional<const Rectangle2D&> NIL Desired area to compare
Input value
inMask Optional<const Region&> NIL Range of pixels to compare
Input value
inTemplateAreaAlignment Optional<const CoordinateSystem2D&> NIL Alignment of template bounded by inTemplateArea
Input value
inStdDevX float 0.0 - 2.0f Amount of horizontal smoothing used by the edge filter
Input value
inStdDevY Optional<float> 0.0 - NIL Amount of vertical smoothing used by the edge filter (Auto = inStdDevX)
Input value
inEdgeThreshold float 0.0 - 35.0f Sufficient edge strength; edges of that strength will always be detected on the template image
Input value
inEdgeHysteresis float 0.0 - 15.0f Value by which the edge threshold is decreased for edge points neighboring with sufficiently strong edges
Output value
outGoldenTemplate EdgeGoldenTemplate& The output golden template structure
Diagnostic input
diagCroppedImage Image& Cropped image to be analyzed
Diagnostic input
diagCroppedEdges Region& Edges found on the cropped image
Diagnostic input
diagEdges Region& Edges projected onto the input image

Description

This filter creates a template structure that can be later used in CompareGoldenTemplate_Edges filter.

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.

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 inTemplateImage input with the image containing the perfect object.
  • Set inEdgeThreshold, inEdgeHysteresis, inStdDevX and inStdDevY as in DetectEdges_AsRegion filter. These will control detection of the edges used for object comparison.

Remarks

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

See Also

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