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):

  1. Add the EnumerateImages filter to the Main macrofilter to load images from the input directory.

  2. Add the LocateMultipleObjects_NCC filter.

  3. Open the model editor for inGrayModel and mark a template as in the image below. Set the Rotation Tolerance parameter to 2 degrees.

  4. To reliably detect all missing chips, set inMaxPyramidLevel to:

  5. To get the count of matched missing objects, expand the field Count of outObjects.

  6. 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