Professional Documents
Culture Documents
CV Lecture 06 FeatureDetection
CV Lecture 06 FeatureDetection
Lecture 6
FEATURE DETECTION and MATCHING
Today’s Topics
¢ Feature Detection
¢ Feature Description
¢ Feature Matching
2
Questions of Interest
¢ How to find camera parameters?
¢ Where is the camera, where is it directed at?
¢ What is the movement of the camera?
3
Introduction to
Feature Detection
4
Image Mozaics
Object Recognition
Image Matching
Image Matching using Feature
Points
13
Invariant Local Features
Features Descriptors
Choosing interest points
Where would you tell
your friend to meet
you?
In computer vision, an interest point (also known as a keypoint or
feature point) is a specific location or point in an image that has
unique and distinguishable characteristics. Interest points are
used to identify and match corresponding features between
different images or frames. These points are selected based on
their properties, such as intensity variations, corners, edges, or
other distinctive patterns.
R ( u, v ) = å I ( x + u, y + v ) I ( x , y )
( x , y )ÎW
Autocorrelation Calculation
R ( u, v ) = å I ( x + u, y + v ) I ( x , y )
( x , y )ÎW
x, y
I(x, y)
E(u, v)
E(3,2)
w(x, y)
Corner Detection: Mathematics
Change in appearance of window w(x,y)
for the shift [u,v]:
E (u, v) = å w( x, y) [ I ( x + u, y + v) - I ( x, y) ]
2
x, y
I(x, y)
E(u, v)
E(0,0)
w(x, y)
Corner Detection: Mathematics
Change in appearance of window w(x,y)
for the shift [u,v]:
E (u, v) = å w( x, y) [ I ( x + u, y + v) - I ( x, y) ]
2
x, y
Source: R. Szeliski
Corner Detection: Mathematics
Change in appearance of window w(x,y)
for the shift [u,v]:
E (u, v) = å w( x, y) [ I ( x + u, y + v) - I ( x, y) ]
2
x, y
We want to find out how this function behaves for small shifts
E(u, v)
Corner Detection: Mathematics
E (u, v) = å w( x, y) [ I ( x + u, y + v) - I ( x, y) ]
2
x, y
We want to find out how this function behaves for small shifts
x, y
x, y
E vv (0,0) = å 2w( x, y )I y ( x, y ) I y ( x, y )
x, y
x, y
E vv (0,0) = å 2w( x, y )I y ( x, y ) I y ( x, y )
x, y
éu ù
E (u, v) » [u v] M ê ú
ëv û
where M is a second moment matrix computed from image
derivatives:
é I x2 IxI y ù
M = å w( x, y) ê 2 ú
x, y êë I x I y I y úû
M
Corners as distinctive interest points
éI x I x IxI y ù
M = å w( x, y ) ê ú
ëI x I y IyIy û
2 x 2 matrix of image derivatives (averaged in
neighborhood of a point).
¶I ¶I ¶I ¶I
Notation: Ix Û Iy Û IxI y Û
¶x ¶y ¶x ¶y
Interpreting the second moment matrix
é I x2 IxI y ù
M = å w( x, y) ê 2 ú
x, y êë I x I y I y úû
Interpreting the second moment matrix
é I 2
I x I y ù él1 0 ù
M = å w( x, y) ê x
2 ú
=ê ú
x, y êë I x I y I y úû ë 0 l2 û
If either λ is close to 0, then this is not a corner, so
look for locations where both are large.
Interpreting the second moment matrix
(lmax)-1/2
(lmin)-1/2
Interpreting the eigenvalues
Classification of image points using eigenvalues
of M:
l2 “Edge”
l2 >> l1 “Corner”
l1 and l2 are large,
l1 ~ l2;
E increases in all
directions
l1
Corner response function
R = det( M ) - a trace(M ) 2 = l1l2 - a (l1 + l2 ) 2
α: constant (0.04 to 0.06)
“Edge”
R<0 “Corner”
R>0
|R| small
“Flat” “Edge”
region R<0
Harris corner detector
-1 0 1 1 2 1
-2 0 2 0 0 0
-1 0 1 -1 -2 -1
K. Grauman, B. Leibe
Feature
Description
57
Feature Descriptor
¢ How can we extract feature descriptors that are invariant to
variations (transformations) and yet still discriminative
enough to establish correct correspondences?
?
Transformation Invariance
Find features that are invariant to transformations
l geometric invariance: translation, rotation, scale
l photometric invariance: brightness, exposure
Transformation Invariance
¢ Illumination
Types of invariance
¢ Illumination
¢ Scale
Types of invariance
¢ Illumination
¢ Scale
¢ Rotation
Types of invariance
¢ Illumination
¢ Scale
¢ Rotation
¢ Affine
Types of invariance
¢ Illumination
¢ Scale
¢ Rotation
¢ Affine
¢ Full Perspective
How to Achieve Invariance
1. Make sure the detector is invariant
l Harris is invariant to translation and rotation
l Scale is trickier
• A common approach is to detect features at many scales using a
Gaussian pyramid (e.g., MOPS)
• More sophisticated methods find “the best scale” to represent each
feature (e.g., SIFT)
2. Design an invariant feature descriptor
l A descriptor captures the information in a region around the detected
feature point
l The simplest descriptor: a square window of pixels
• What’s this invariant to?
l Let’s look at some better approaches…
Rotational Invariance for Feature
Descriptors
Ø Find dominant orientation of the image patch. This is given by e+, the
eigenvector of M corresponding to l+
Ø Rotate the patch to horizontal direction
Ø Intensity normalize the window by subtracting the mean, dividing by the
standard deviation in the window
40 pi
xels 8 pixels
0 2p
angle histogram
75
Feature Matching
¢ Given a feature in image I1, how to find the best
match in image I2?
1. Define a distance function that compares two descriptors
2. Test all the features in I2, find the one with minimum distance
Feature Distance
¢ SSD is commonly used to measure the difference
between two features f1 and f2
¢ Use ratio-of-distance = SSD(f1, f2) / SSD(f1, f2’)
as a measure of reliability of the feature match:
l f2 is best SSD match to f1 in I2
l f2’ is 2nd best SSD match to f1 in I2
l Ratio-of-distance is small for ambiguous matches
f1 f2' f2
I1 I2
Evaluating Feature
Matching
Performance
79
Evaluating the Results
50
75
200
feature distance
True/false positives
The distance threshold affects performance
l True positives = # of detected matches that are correct
• Suppose we want to maximize these—how to choose
threshold?
l False positives = # of detected matches that are incorrect
• Suppose we want to minimize these—how to choose
threshold?
50
true match
75
200
false match
feature distance
Precision-Recall and F-measure
In statistical analysis of binary classification, the F1 score (also
F-score or F-measure) is a measure of a test's accuracy. It
considers both the precision p and the recall r of the test to
compute the score:
0.7
true positives
true positive rate (TPR) =
positives
= recall
= sensitivity
0 0.1 1 false
positive
false positives rate
false positive rate (FPR) =
negatives
= 1− specificity
= 1− true negative rate
Receiver Operating Characteristic
(ROC) Curve
• Generated by counting # current/incorrect matches, for different thresholds
• Want to maximize area under the curve (AUC)
• Useful for comparing different feature matching methods
• For more info: http://en.wikipedia.org/wiki/Receiver_operating_characteristic
true
positive
rate