You are here: Start » AVL.NET » AVL.CompareGoldenTemplate_Intensity(AvlNet.Image, AvlNet.GrayGoldenTemplate, AvlNet.CoordinateSystem2D?, float, int, AvlNet.Region, AvlNet.Region, bool, AvlNet.Region)
AVL.CompareGoldenTemplate_Intensity(AvlNet.Image, AvlNet.GrayGoldenTemplate, AvlNet.CoordinateSystem2D?, float, int, AvlNet.Region, AvlNet.Region, bool, AvlNet.Region)
Compares an image with a template image considered to have no defects.
| Namespace: | AvlNet |
|---|---|
| Assembly: | AVL.NET.dll |
Syntax
public static void CompareGoldenTemplate_Intensity( AvlNet.Image inImage, AvlNet.GrayGoldenTemplate inGoldenTemplate, AvlNet.CoordinateSystem2D? inGoldenTemplateAlignment, float inMaxDifference, int inMinDefectRadius, out AvlNet.Region outDefects, out AvlNet.Region outDifferenceRegion, out bool outDefectsPresent, out AvlNet.Region outEdgeRegion )
Parameters
- inImage
- Type: AvlNet.Image
Input image - inGoldenTemplate
- Type: AvlNet.GrayGoldenTemplate
Golden gray template containing image of an object with no defects - inGoldenTemplateAlignment
- Type: System.Nullable<AvlNet.CoordinateSystem2D>
Adjusts the golden template to the position of the inspected object, or null. - inMaxDifference
- Type: System.Single
Maximal allowed difference between corresponding pixels of the input and golden images - inMinDefectRadius
- Type: System.Int32
Minimal radius of a defect - outDefects
- Type: AvlNet.Region
Region of detected defects - outDifferenceRegion
- Type: AvlNet.Region
Region of pixels differing too much between the golden image and the input image - outDefectsPresent
- Type: System.Boolean
Flag indicating whether any defects were detected - outEdgeRegion
- Type: AvlNet.Region
Region of pixels that will not be compared
Description
This filter compares pixels of the input images against a template image stored in passed inGoldenTemplate input. Then creates a region containing only pixels in which intensity difference is higher than inMaxDifference value as a result. This 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.
When the defected pixels are found only consistent regions are selected. Minimal radius of accepted region is set in inMinDefectRadius.
You can define a part of an image when defining inGoldenTemplate.
More information about this technique can be found in Machine Vision Guide: Golden Template.
Examples
![]() |
![]() |
CompareGoldenTemplate_Intensity performed on sample image. A part of the object is missing – it is marked in blue on the right.
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
| Error type | Description |
|---|---|
| DomainError | Input image format is incompatible with golden template image format in CompareGoldenTemplate_Intensity. |


