PatMax Pattern Theory of Operation

The FindPatMaxPattern function uses a two-step process to locate and score a pattern. In the first step, the raw image is searched using a coarse pattern filter to locate potential candidates that might be a good match. All the parameters are considered: Accept, Contrast, Clutter in Score, Angle, Scale, Aspect, XY Overlap, etc. Each parameter is given a weighted score and the final score is a combination of all the individual scores. Even if one or more of the parameters are scored very poorly, it is possible for the remaining parameters to produce a score that exceeds the Accept parameter value. The data for every candidate that exceeds the Accept parameter value is placed into a memory array.

Note: Even if only one object is present, it is possible for multiple candidates to be found.

Consider the case of a circular object such as a coin. The coarse filter may not detect much of the fine detail on the face of the coin, but can easily detect the circular perimeter. The problem is that there are an infinite number of potential angular matches to a circle because a circle looks the same at any rotation angle. Based on any other detail the coarse filter can detect, it can come up with several potential candidates and place each one into memory.

The second step uses a fine pattern filter to review each of the candidates stored in memory. Each of the parameters is scored again, but this time much more accurately. The candidate with the highest final score is then returned as the result. If N patterns are to be found, then the top N candidates are returned in the order of their scores.

Note: If the coarse filter in the first step does not find a particular "correct" candidate and place it into memory, the fine filter in the second step cannot score it. The second step does not scan the raw image again for any missed candidates. Therefore, it is critically important to define the pattern model and the parameters in a way that ensures the "correct" candidate will always be found in the first step, even if it is not a particularly good match.

For example, suppose a poor but correct candidate scores only 59.5 in the coarse search. If the Accept parameter is set to 60, this candidate will be rejected, and the fine search will never see it. If the Accept parameter is lowered to 59, then this candidate will be considered by the fine search and may even return a very high score.