Back to Aurora Vision Library website

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

CreateGoldenTemplate_Intensity


Header: AVL.h
Namespace: avl
Module: FoundationPro

Creates golden template for application in CompareGoldenTemplate_Intensity filter.

Syntax

C++
C#
 
void avl::CreateGoldenTemplate_Intensity
(
	const avl::Image& inTemplateImage,
	atl::Optional<const avl::Rectangle2D&> inTemplateArea,
	atl::Optional<const avl::Region&> inMask,
	atl::Optional<const avl::CoordinateSystem2D&> inTemplateAreaAlignment,
	const float inEdgeThreshold,
	const int inEdgeDilation,
	avl::GrayGoldenTemplate& outGoldenTemplate,
	avl::Image& diagCroppedImage,
	avl::Region& diagCroppedEdgeRegion,
	avl::Region& diagEdgeRegion
)

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 inEdgeThreshold const float 0.0 - 10.0f Minimum strength of edges on the golden image near which comparison is NOT performed
Input value inEdgeDilation const int 0 - 1000000 1 Defines for how far from the detected edges comparison is NOT performed
Output value outGoldenTemplate GrayGoldenTemplate& The output golden template structure
Diagnostic input diagCroppedImage Image& Cropped image to be analyzed
Diagnostic input diagCroppedEdgeRegion Region& Region of pixels that will not be compared
Diagnostic input diagEdgeRegion Region& Edges projected onto the input image

Description

This filter creates a template structure that can be later used in CompareGoldenTemplate_Intensity filter. This golden template method is especially useful for finding defects like: smudges, noises and dust particles. It can be used for finding missing holes or changes in complex shapes.

Filter finds edges on an image and removes nearby pixels to avoid comparing pixels near edges which may contains some distortions due to shadows or changes in lightning. Input inEdgeDilation defines the width of the quiet zone around the edges and the parameter inEdgeThreshold define how strong must be change of the color between pixels to treat them as an edge.

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 to a value that assures detection of all object edges, so that defects appearing near the edges can be ignored. Verify this setting with the diagEdgeRegion output – it should be present near the edges.

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