Improving the Score of Matching Instances by Using "Don't Care Areas"

Setting Search Parameters

Objective

Following this tutorial, you will learn how to use EasyMatch to handle "don't care areas". "Don't care areas" help to define in the image the meaningful features only, by masking the areas that might change from image to image.

You'll need first to load a reference image and learn the reference model (steps 1-2). Then you'll perform automatic pattern matching of instances of the reference model, without using "don't care areas" (step 3). As the matching scores of the found instances are not high enough, you'll define a "don't care area" on the reference model, and restart the detection. The matching scores are much better (steps 4-5).

Reference model

    

Found instances and matching scores, without (left) and with (right) using "don't care areas"

Step 1: Load the reference image

1. From the main menu, click EasyMatch, then New Match Tool.
2. Keep the default variable name for the new Matcher object, and click OK. The Matcher management dialog box is opened.
3. In the Learning tab, click the Open icon, and load the image file EasyMatch\Die Pad Model 1.bmp.
4. Keep the default variable name for the new Image object, and click OK.

Step 2: Learn the reference model

Click Learn to acquire the model pattern.

Step 3: Detect instances of the reference model without "don't care areas"

1. In the Matching tab, click the Open icon, and load the image file EasyMatch\Die Pad 1.bmp.
2. Keep the default variable name for the new Image object, and click OK. An instance matching the reference model is highlighted.
3. Increase the Max Occurrences field to 3. Enable the Sub-Pixel Interpolate check-box to increase the matching precision.
4. Enter '-10.0' as the Minimum Angle (Deg). (Check that the angle is displayed in degrees. If not, select the angles unit from View > Option menu.)
5. Enter '10.0' as the Maximum Angle (Deg).
6. Click Execute. The pattern locations are highlighted in the source image.
7. Click Results to see the matching score of each found instance. The last two scores are rather bad. This is mainly due to the bright rectangle on the upper part of the reference image we have learned. We can improve the scores by using a "don't care area" to mask this bright area.

Step 4: Define the "don't care area"

1. In the Don't Care Areas tab, select the Rectangle radio button from the Blacken Inside group.
2. In the reference image, move your mouse pointer on the lower left corner of the bright rectangle, left-click and drag the don't care area (rectangle with red stripes) to the upper right corner of the bright rectangle to mask out this area.
3. In the Don't Care Areas tab, click Learn.

Step 5: Detect instances of the reference model with "don't care areas"

1. In the Matching tab, click Execute. The instances matching the reference model are still highlighted.
2. Click Results to compare the new matching scores. They are much better.