Testing the ratio for outlier removal

The more correct matches that are found (which means that more pattern-to-image correspondences exist), the higher the chance that the pattern is present in the image. However, some matches might be false positives.

A well-known technique for removing outliers is called the ratio test. Since we performed kNN-matching with k=2, the two nearest descriptors are returned for each match. The first match is the closest neighbor and the second match is the second-closest neighbor. Intuitively, a correct match will have a much closer first neighbor than its second-closest neighbor. On the other hand, the two closest neighbors will be at a similar distance from an incorrect match.

Therefore, we can find out how good a match is by looking at the difference between the distances. The ratio test says that the match is good only if the distance ratio between the first match and the second match is smaller than a given number (usually around 0.5). In our case, this number is chosen to be 0.7. The following snippet finds good matches:

# discard bad matches, ratio test as per Lowe's paper
good_matches = [ x[0] for x in matches
if x[0].distance < 0.7 * x[1].distance]

To remove all matches that do not satisfy this requirement, we filter the list of matches and store the good matches in the good_matches list.

Then, we pass the matches we found to FeatureMatching.match so that they can be processed further:

return good_matches 

However, before elaborating on our algorithm, let's first visualize our matches in the next section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.150.109