You are here: Start » Tutorial Exercises » Gray-based Template Matching: Basic (gbtm_basic)
Gray-based Template Matching: Basic (gbtm_basic)
Aim
Your task is to create a simple algorithm which will be able to detect a marker on a printed circuit board.
Input
Images of a printed circuit board at different rotations.
The input image is stored in
gbtm_basic
directory.
Output
An application that detects the marker.
Hints
This exercise shows the way to find an object in an image using Gray-based Template Matching. To use GbTM please use the LocateSingleObject_NCC filter.
Solution (AVS)
-
Add the EnumerateImages filter to load consecutive images from a disk directory.
-
Add the LocateSingleObject_NCC filter and connect it with the input image.
-
Open a template matching editor on inGrayModel and set model parameters as on the image below.
-
In the next tab mark object like an image below.
-
Add the outImage and outObject.Match outputs to a data preview.
-
Perform several iterations of the program and verify if the results are correct.
-
If the object is not always found, this is most likely due to too high value of the inMaxPyramidLevel input (try 3 and also see what is on the diagImagePyramid diagnostic output). Another solution might be to reduce the value of the inMinScore input (try 0.6).