7.3.3.5.13   Specifying Advanced Model Use Parameters

Via the menu item Usage ▹ Advanced Use Parameters the tab Usage is opened and you can specify advanced parameters.

For shape-based matching the following parameters can be specified:

For correlation-based matching the following parameters can be specified:

For deformable matching the following parameters can be specified:

For descriptor-based matching the following parameters can be specified:

Once you are finished setting search parameters, continue to inspect the results.

7.3.3.5.13.1   The Search Parameter Greediness (Shape-based Matching, Deformable Matching)

The parameter Greediness influences the search algorithm used by the Matching Assistant. It ranges between 0 and 1. If you select a low value, the search is thorough but relatively slow. The higher the value, the faster the search algorithm becomes, but at the cost of thoroughness, i.e., an object might not be found even though it is visible in the image.

This parameter can be optimized easily: Starting from the value 0, increase the value until the matching fails in a test image, and then use the last value for which the object is found; in fact, this method is used by the Matching Assistant itself when you start the optimization via the menu item Usage ▹ Optimize Recognition Speed.

7.3.3.5.13.2   The Search Parameter Maximum Overlap (Shape-based Matching, Correlation-based Matching, Deformable Matching)

The parameter Maximum Overlap specifies how much two matches may overlap in the image; its value ranges between 0 and 1. Especially in the case of an almost symmetric object the allowed overlap should be reduced to prevent multiple matches on the same object.

7.3.3.5.13.3   The Search Parameter Subpixel (Shape-based Matching, Correlation-based Matching, Deformable Matching)

The parameter Subpixel allows you to select the accuracy with which the position, orientation, and scale are calculated. If you select the value 'none', the position is determined only with pixel accuracy, and the accuracy of the orientation and scale is equal to the angle step size and scale step size, respectively.

If you select the value 'interpolation', the Matching Assistant examines the matching scores at the neighboring positions, angles, and scales around the best match and determines the maximum by interpolation. Using this method, the position is therefore estimated with sub-pixel accuracy. The accuracy of the estimated orientation and scale depends on the size of the object: The larger the size, the more accurately the orientation and scale can be determined. For example, if the maximum distance between the center and the boundary is 100 pixels, the orientation is determined with an accuracy of about 0.1°.

Because the interpolation is very fast, you can select 'interpolation' in most applications.

When you choose the values 'least_squares', 'least_squares_high', or 'least_squares_very_high', a least-squares approximation is used instead of an interpolation, resulting in an even higher accuracy. However, this method requires additional computation time.

7.3.3.5.13.4   The Search Parameter Max Deformation (Shape-based Matching)

The parameter Max Deformation enables you to allow a certain deviation (in pixels) of the found edges from the model edges. Note that higher values for Max Deformation often result in an increased runtime. Furthermore, the higher the Max Deformation value is chosen, the higher is the risk of finding wrong model instances. Both problems mainly arise when searching for small objects or for objects with fine structures. This is because such kinds of objects lose their characteristic shape which is important for a robust search if the deformations are to extreme. Also note that for higher deformations the accuracy of partially occluded objects might decrease if clutter is present close to the object. Consequently, the value for Max Deformation should be chosen as small as possible and only as high as necessary.

For more information, please refer to the reference documentation of the HALCON operator find_shape_model.

7.3.3.5.13.5   The Search Parameter Last Pyramid Level (Shape-based Matching, Correlation-based Matching, Deformable Matching)

With the parameter Last Pyramid Level you can select the lowest pyramid level to which the found matches are tracked. For example, when selecting the value 2, the matching starts at the highest pyramid level and tracks the matches to the second lowest pyramid level (the lowest pyramid level is denoted by a value of 1).

This mechanism can be used to speed up the matching. It should be noted, however, that in general the accuracy of the extracted position, orientation, and scale is lower in this mode than in the normal mode, in which the matches are tracked to the lowest pyramid level. Hence, if a high accuracy is desired, the parameter Subpixel should be set to at least 'least_squares'.

Note that if the lowest pyramid level to use is chosen too large, it may happen that the desired accuracy cannot be achieved, or that wrong instances of the model are found because the model is not specific enough on the higher pyramid levels to facilitate a reliable selection of the correct instance of the model. In this case, the lowest pyramid level to use must be set to a smaller value.

7.3.3.5.13.6   The Parameter Timeout (Shape-based Matching, Correlation-based Matching)

Setting a timeout can improve the overall speed of your application as the program will then stop searching for a model within an image after a certain time. To use the Timeout function, activate Enable on the right side of the tab. Then choose the time in milliseconds after which the search for a model shall be aborted. Activating the Timeout is especially useful in cases where a maximum cycle time has to be ensured. Be aware that the runtime of the search increases by up to 10 percent with activated Timeout.

For more information, please refer to the reference documentation of the HALCON operator set_shape_model_param.

7.3.3.5.13.7   The Search Parameter Increased tolerance mode (Shape-based Matching)

The Increased tolerance mode allows you to increase the searching tolerance and, therefore, also increase speed. The matching is then less robust and accurate but faster and might find deformed and defocused objects in an image.

The first value of NumLevels determines the number of pyramid levels, the second level determines at which pyramid level the search for the model will stop. If the Increased tolerance mode is enabled, the second value of NumLevels will be negative. If this value is negative, the search for the model will stop on the lowest pyramid level where a model is detected.

Therefore, the increased tolerance mode is useful

7.3.3.5.13.8   The Search Parameter Shape models may cross the image border (Shape-based Matching)

With the parameter Shape models may cross the image border, you can specify whether shape models that cross the image border, i.e., that lie partially outside the test images, should be searched for.

If you switch off the check box Shape models may cross the image border the shape model will only be searched for within those parts of the test images in which the shape model completely lies within the image.

If you switch on the check box Shape models may cross the image border the shape model will be searched for in all positions in which the model additionally lies partially outside the test images, i.e., in which the shape model extends beyond the image border. Here, points lying outside the image are regarded as being occluded, i.e., they lower the score. This should be taken into account while selecting the Minimum Score. Please note that the runtime of the search will increase in this mode.

7.3.3.5.13.9   The Search Parameter Score Type

Score Type defines the type of score to be evaluated. You have two options to choose from:

inlier_ratio defines the ratio of the number of point correspondences to the number of model points. Although this value can have values of from 0.0 to 1.0, it is rather unlikely that this ratio can reach 1.0. Yet, objects having inlier ratio less than 0.1, should be disregarded.

num_points defines the number of point correspondences per instance. An object instance should be considered good, if it has 10 or more point correspondences with the model. Fewer points are insufficient, because any random 4 point correspondences define a mathematically correct homography between two images.

7.3.3.5.13.10   The Search Parameter Descriptor Min. Score

Decriptor Min. Score is the minimal classifier score for an interest point to be regarded as a potential match. The score function is between 0.0 and 1.0, but typically only values between 0.0 and 0.1 make sense (default = 0.0). Increasing the value for Min. Score can increase the detection speed significantly. Note, however, that using Descriptor Min. Score might have negative effect on the robustness of the detection process, especially when only few points can be found.

7.3.3.5.13.11   The Search Parameter Guided Matching

Enable Guided Matching to use an already approximately known homography to 'guide' the matching process, which enhances the accuracy of the object recognition. Note that it increases the computational costs up to 10% in some cases.