Matching & ratio test

Features of two images are matched by comparing their descriptors. The second image here is a transformed copy of the first, so every match can be checked. Compare a threshold on the descriptor distance with the ratio test, and see which one separates correct from incorrect matches better.

Image AA and transformed image BB correct match incorrect match
Distance d1d_1 to the nearest neighbor correct incorrect
Ratio d1/d2d_1 / d_2 correct incorrect
Correct vs incorrect accepted matches, over all thresholds distance d1d_1 ratio d1/d2d_1 / d_2 all correct matches possible

Matching by distance

After detection and description, every feature is a 128-dimensional vector. To find correspondences:

This has two problems:

Nearest neighbor distance ratio

The ratio test compares the distance d1d_1 to the closest neighbor NN1 with the distance d2d_2 to the second closest NN2:

accept if d1d2≤τ\text{accept if } \frac{d_1}{d_2} \le \tau

Sorting by the ratio puts the matches in order of confidence. Lowe computed the distribution of the ratio for 40,000 keypoints with hand-labeled ground truth: correct matches pile up at low ratios, incorrect ones near 1. The second nearest neighbor serves as an estimate of how close an incorrect match can be in this part of feature space.

Choosing the threshold

The threshold depends on the application's trade-off between false positives and true positives. With a low threshold such as 0.5 there are few false positives but also fewer matches; a higher threshold such as 0.8 keeps more of the true positives and lets in more false positives. Lowe's choice of 0.8 removes about 90% of the incorrect matches while losing less than 5% of the correct ones. The large plot shows this trade-off for both criteria: each curve starts at the strictest threshold and ends when every match is accepted. A curve that climbs more steeply finds more correct matches for the same number of incorrect ones.

The ground truth here comes from the known transformation: a match is correct if the keypoint in BB lies within ε\varepsilon pixels of the mapped keypoint of AA. Only features in the region both images show take part. A feature may have no partner at all, if the detector didn't find its point again in BB; the dashed line shows how many correct matches are possible.

Try this