You are here: Start » Tutorial Exercises » Gray-based Template Matching: Missing Chip (gbtm_missing_chip)

Gray-based Template Matching: Missing Chip (gbtm_missing_chip)

Aim

Your task is to create a simple algorithm which detects empty pads on a printed circuit board.

Input

A set of images with a grid of prepared pads ready for soldering process.

The input image is stored in gbtm_missing_chip directory.

Output

An algorithm that finds the number of missing elements and the center of each missing element.

Hints

This exercise shows 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 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 creation of a model which 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 (AVS)

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

  2. Add 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 field Count of outObjects.

  6. To get the center points of found objects, use the outObjects.Point output of LocateMultipleObjects_NCC filter.

Main Macrofilter finds positions of missing elements using Gray-based Template Matching technique.

Further Readings