You are on page 1of 18

Lecture 4.

2
Feature matching
Trym Vegard Haavardsholm
Overview of point feature matching

1. Detect a set of distinct feature points

2. Define a patch around each point

3. Extract and normalize the patch

4. Compute a local descriptor

5. Match local descriptors

2
Distance between descriptors

• Define distance function that compares two descriptors

– L1 distance (SAD):

d ( f a=
, fb ) ∑ f a − fb

– L2 distance (SSD):

∑ ( f a − fb )
2
d ( f=
a , fb )

– Hamming distance:

d ( f a , fb ) = ∑ XOR( f a , fb )

3
At which threshold do we get a good match?

• The distance threshold affects performance

4
Evaluating matching performance

5
Evaluating matching performance

AUC: Area Under the Curve

6
Matching strategy

• Compare all

• Take the closest


– Or k closest
– And/or within a (low) thresholded distance

7
Matching strategy

• Compare all • Choose the N best putative matches

• Take the closest


– Or k closest
– And/or within a (low) thresholded distance

8
Which matches are good?

• Can get good scores for ambiguous or incorrect matches

9
Nearest Neighbour Distance Ratio

• For a descriptor fa in Ia, take the two closest descriptors fb1 and fb2 in Ib
• Perform ratio test: d(fa, fb1) / d(fa, fb2)
– Low distance ratio: fb1 can be a good match
– High distance ratio: fb1 can be an ambiguous or incorrect match

10
Nearest Neighbour Distance Ratio

• For a descriptor fa in Ia, take the two closest descriptors fb1 and fb2 in Ib
• Perform ratio test: d(fa, fb1) / d(fa, fb2)
– Low distance ratio: fb1 can be a good match
– High distance ratio: fb1 can be an ambiguous or incorrect match

11
Nearest Neighbour Distance Ratio

• For a descriptor fa in Ia, take the two closest descriptors fb1 and fb2 in Ib
• Perform ratio test: d(fa, fb1) / d(fa, fb2)
– Low distance ratio: fb1 can be a good match
– High distance ratio: fb1 can be an ambiguous or incorrect match

David G. Lowe. "Distinctive image features from scale-invariant keypoints.” IJCV 60 (2), pp. 91-110, 2004
12
Example: Holmenkollen

13
Example: Holmenkollen

14
Cross check test

• Choose matches (fa, fb) so that • Alternative to ratio test


– fb is the best match for fa in Ib
– And fa is the best match for fb in Ia

15
Cross check test

• Choose matches (fa, fb) so that • Alternative to ratio test


– fb is the best match for fa in Ib
– And fa is the best match for fb in Ia

16
Matching algorithms

• Comparing all features works well for small sets of images


– Brute force: BFMatcher in OpenCV

• When the number of features is large, an indexing structure is required


– For example a k-d tree
– Training an indexing structure takes time, but accelerates matching
– FlannBasedMatcher in OpenCV

17
Summary

• Matching keypoints
– Comparing local patches in canonical scale and orientation

• Feature descriptors
– Robust, distinctive and efficient

• Descriptor types
– HoG descriptors
– Binary descriptors

• Putative matching
– Closest match, distance ratio, cross check

• Next lecture
– Matches that fit a model
18

You might also like