You are here: Start » Tutorial Exercises » Gray-based Template Matching: Missing Chip
Gray-based Template Matching: Missing Chip
Aim:
Your task is to create a simple algorithm that detects empty pads on a printed circuit board.
Input:
A set of images with a grid of prepared pads ready for the soldering process.
The input image is stored in the gbtm_missing_chip directory.
Output:
An algorithm that finds the number of missing elements and the center of each missing element.
Hints:
This exercise demonstrates a way to find an object in an image using Gray-based Template Matching.
In this problem, a missing element should be treated as a template matching model. Find a missing element using the LocateMultipleObjects_NCC filter.
In this case, the background inside a missing chip is irregular. Creating an edge-based template model using boundary points will result in the creation of a model that will find all objects in the image.
The image below shows the irregularities in the background of missing elements.
Labeling connections is explained in this article.
Solution (FIS):
-
Add the EnumerateImages filter to the Main macrofilter to load images from the input directory.
-
Add the LocateMultipleObjects_NCC filter.
-
Open the model editor for inGrayModel and mark a template as in the image below. Set the Rotation Tolerance parameter to 2 degrees.
-
To reliably detect all missing chips, set inMaxPyramidLevel to:
-
1 and keep inMinScore at 0.7, or
-
2 and reduce inMinScore to 0.5
-
-
To get the count of matched missing objects, expand the field Count of outObjects.
-
To get the center points of found objects, use the outObjects.Point output of the LocateMultipleObjects_NCC filter.
Main Macrofilter finds positions of missing elements using Gray-based Template Matching technique.
Further Readings
- Template Matching - Most detailed description of the Template Matching technique.