You are here: Start » Program Examples » Comparing Golden Template
Comparing Golden Template
Aim
This example shows how to find defects at the end of a blade. Golden Template technique can be used to find even the smallest defect.
Input
Set of images with a single blade.

Output
Image with marked defects on it.

Hints
Best way to find defects is to locate blade using Template Matching and compare the matches with Golden Template technique.
Use a filter CropImageToRectangle to utilize template matching matches for reducing a comparison image.
In this case both filters can be used CompareGoldenTemplate_Intensity and CompareGoldenTemplate_Edges. But CompareGoldenTemplate_Intensity provides more information about defects.
Solution (Studio)
-
Add the EnumerateImages filter to load images from the images directory.
-
Find the position of an object add filter LocateSingleObject_Edges and prepare a template model like on the image below:

-
Use the match found to crop a part of the image which should be compared. Add filter CropImageToRectangle and connect it with outObject.Match.
-
Iterate through images and save in a global parameter the output image of CropImageToRectangle which contains a not damaged blade. Name this parameter Template.
-
Add filter CompareGoldenTemplate_Intensity and connect to inImage output of CropImageToRectangle. To the inGoldenImage connect the global parameter Template.
-
Configure the CompareGoldenTemplate_Intensity by setting inEdgeThreshold to 35.0 and inMaxDifference to 10.0.
-
To prepare output image add the DrawRegions_SingleColor filter and use connect to it output from the CropImageToRectangle and from the outDefects
Macrofilter Main uses the Template Matching and Golden Template techniques to find defects on a blade.

Used Filters
| Icon | Name | Description |
|---|---|---|
| LocateSingleObject_Edges | Detection of an object whose outlines are sharp and rigid. Often one of the first filters in a program. | |
| CropImageToRectangle | Usually used for creating images of individual objects, e.g. after Template Matching. | |
| EnumerateImages | Emulates image acquisition with images stored on disk. | |
| CompareGoldenTemplate_Intensity | Finding general object defects by analyzing brightness deviations from a template image. | |
| DrawRegions_SingleColor | Apart from drawing can also be used to "clear" a part of an image. |
