You are here: Start » Program Examples » Mounts (Golden Template Edges)
Mounts (Golden Template Edges)
Aim:
The task is to detect mounts and divide them into OK/NG parts.
Input:
An image of mounts. The position of the objects is variable. Some of the objects are damaged.
Output:
The marked mounts divided into OK and NG objects. The defects are also visible.
Hints:
The location of the object is variable. To separate OK and NG parts, the GoldenTemplate technique can be used.
Use the ClassifyByPredicate to mark OK and NG items and the DilateRegion to enlarge the missing edges.
Solution (FIS):
-
In Workspace Explorer, open the workspace Examples, and in the Filmstrip window, select the Mounts dataset. Drag the Image channel to the ACQUIRE section. Label the output as Image
-
Add the LocateMultipleObjects_Edges1 to find position of the mounts:
- Connect its inImage input to the Image
- In the Edge Model editor, mark a correct object, like in the picture below.
- Label the outObjects.Match as Match, the outObject.Alignment as Alignment and the outObjects.Score as Scores.
-
Add the CompareGoldenTemplate_Edges to test the objects:
- Connect its inImage input to the Image.
- In the Properties section, set the inGoldenTemplateAlignment to the Alignment.
- In the EdgeGoldenTemplate editor, mark the same object as in the LocateMultipleObjects_Edges1.
- Set the inStdDevX to 2.2.
- Set the inEdgeThreshold to 55.
- Set the inEdgeHysteresis to 13.
- Set the inMaxDistance to 7.
- Label the outDefects as Defects.
- Right click on the Defects and choose the Area. Label the output as DefectsArea.
- Label the outDefectsPresent as DefectsPresent.
-
Add the DilateRegion to enlarge the defects edges:
- Connect its input to the Defects.
- Set the inRadiusX to 0.
- Label the output as DefectsStronger.
-
Add the ClassifyByPredicate to divide objects into OK and NG parts:
- Connect the inArray to the Match and the inPredicate to the DefectsPresent.
- The outAccepted are the NG mounts and the outRejected are the OK mounts.
Macrofilter Main.
Further Readings
- Golden Template - Article explaining how Golden Template technique works.