\(E(u, v) =\) amount of change when
you shift the window by \((u, v)\)
\(E(u, v)\) is small for all
shifts
\(E(u, v)\) is small for some
shifts
\(E(u, v)\) is large for all
shifts
We want \(\min_{u, v} E(u, v)\) to
be large, i.e., maximize \(\lambda_-\)
Corner Detection Recipe 1/2
Compute the gradient at each point in the image.
Create the \(H\) matrix from the
entries in the gradient.
Compute the eigenvalues.
Find points with large response (\(\lambda_-\) > threshold).
Choose those points where \(\lambda_-\) is a local maximum as
features.
\(I\)
\(\lambda_+\)
\(\lambda_-\)
Corner Detection Recipe 2/2
Compute the gradient at each point in the image.
Create the \(H\) matrix from the
entries in the gradient.
Compute the eigenvalues.
Find points with large response (\(\lambda_-\) > threshold).
Choose those points where \(\lambda_-\) is a local maximum as
features.
\(\lambda_-\)
Corner Detection: Harris Operator
Thresholding \(\lambda_-\) is also
known as “Shi-Tomasi corners” or “Good Features to Track” (Shi &
Tomasi, CVPR 1994)
This is a variant of the “Harris operator” for corner detection:
\[f = \frac{\lambda_+ \lambda_-}{\lambda_+ +
\lambda_-} = \frac{\det(H)}{\text{trace}(H)}\]
The trace is the sum of the diagonals, i.e., \(trace(H) = h_{11} + h_{22} = I_x^2 +
I_y^2\)
Very similar to \(\lambda_-\), but
less expensive (no square root).
Called the “Harris Corner Detector” or “Harris Operator” (Harris and
Stephens, AVC 1988)
Lots of other detectors, this is one of the most popular
Corner Detection: Harris Operator vs Shi Tomasi
Harris Detector Example 1/5
Original Image
Harris Detector Example 2/5
Harris Corner Response
Harris Detector Example 3/5
Thresholded Harris Corner
Response
Harris Detector Example 4/5
Local Maxima of Harris Corner
Response
Harris Detector Example 5/5
Harris Corner Response
FAST Detector
Features from Accelerated Segment Test
Check relation of brightness values to center pixel along
circle
Specific number of contiguous pixels brighter or darker than
center
Very fast corner detection
Rosten, Drummond, Fusing Points and Lines
for High Performance Tracking, ICCV 2005
Section: Keypoint Descriptors
Keypoint Descriptors
We know how to detect good points.
Next question: How to match them?
Idea: extract distinctive descriptor vector from a local patch
around the keypoint.
Invariance 1/2
Goal: match keypoints regardless of image transformation.
This is called transformational invariance.
Most keypoint detection and description methods are designed to be
invariant to:
Translation, 2D rotation, scale
They can usually also handle:
Limited 3D rotations (SIFT works up to about 60 degrees)
Limited affine transformations (some are fully affine
invariant)
Limited illumination/contrast changes
Invariance 2/2
Make sure your detector is invariant.
Harris is invariant to translation and rotation.
Scale is trickier:
Image pyramids
Scale selection for blobs (f.e. SIFT)
Keypoints at multiple scales for same location
Design an invariant feature descriptor
A descriptor captures the information in a region around the
detected feature point.
The simplest descriptor: a square window of pixels
What’s this invariant to?
Let’s look at some better approaches…
Image: “Visual representation of an image
pyramid with 5 levels” by Cmglee used under CC BY-SA 3.0
2D Rotation Invariance
Idea: align the descriptor with a dominant 2D orientation
Some possible approaches:
Use the eigenvector of H corresponding to larger eigenvalue
Use intensity centroid (ORB)
Figure by Matthew Brown
2D Rotation Invariance: SIFT
Take 16x16 square window around detected feature
Compute edge orientation (angle of the gradient) for each pixel
Throw out weak edges (threshold gradient magnitude)
Create histogram of surviving edge orientations
Select strong local orientation maxima and create one or more
descriptors
SIFT Descriptor
Divide the 16x16 window into a 4x4 grid of cells (2x2 case shown
below)
The epipolar constraint can be computed for a pair of matched 2D
image points when the relative camera pose is known,
here encoded by \(R,T\) (e.g. stereo
pair)
The epipolar plane is spanned by \(\mathbf{x}_L\) and the two camera centers
\(O_L\) and \(O_R\)
The epipolar line is the intersection of the
epipolar plane and the right image plane
The epipolar constraint encodes that \(\mathbf{x}_R\) must lie on the epipolar
line in the right image \[\boxed{\mathbf{x}_R^T \hat{T} R \mathbf{x}_L =
0}\]
\(E = \hat{T} R\) is called the
Essential Matrix
Note that the epipolar constraint is not sufficient to guarantee a
correct match. A wrong match may still lie elsewhere on the epipolar
line. However, in many cases outliers can be correctly filtered.
“Epipolar geometry” by Arne Nordmann
(norro) used under CC BY-SA 3.0 / relative pose R, T added
Epipolar Constraint on the Image Plane: Visualization
Given corresponding image point observations \[\mathscr{Y}_a = \{\mathbf{y}_{a,1}, \ldots,
\mathbf{y}_{a,N}\}\]\[\mathscr{Y}_b =
\{\mathbf{y}_{b,1}, \ldots, \mathbf{y}_{b,N}\}\] of unknown 3D
points \(\mathscr{X} = \{\mathbf{X}_1, \ldots,
\mathbf{X}_N\}\) (expressed in camera frame \(a\)) determine relative motion \(\mathbf{T}_{ba}\) between the
frames
Algebraic approach based on epipolar geometry to recover relative
pose (up to scale) without explicitly recovering 3D point location:
8-point, 5-point algorithm
Applications:
Filtering pairwise feature matches with RANSAC
Monocular SLAM / SfM initialisation
2D-to-3D Motion Estimation
Given a set of 3D points in world frame \(W\)\[\mathscr{X} = \{\mathbf{X}_1, \ldots,
\mathbf{X}_N\}\] and corresponding image observations \[\mathscr{Y}_a = \{\mathbf{y}_{a,1}, \ldots,
\mathbf{y}_{a,N}\}\] determine camera pose \(\mathbf{T}_{wa}\) in world frame
Non-linear optimization requires good initialization.
Non-convex.
A.k.a. Perspective-n-Points (PnP) problem, many approaches exist,
e.g.
Direct linear transform (DLT)
EPnP (Lepetit et al., An accurate O(n) Solution to the PnP problem,
IJCV 2009)
OPnP (Zheng et al., Revisiting the PnP Problem: A Fast, General and
Optimal Solution, ICCV 2013)
Applications:
Localize camera in local keypoint map (with RANSAC)
3D-to-3D Motion Estimation
Given corresponding 3D points in two camera frames \[\mathscr{Y}_a = \{\mathbf{Y}_{a,1}, \ldots,
\mathbf{Y}_{a,N}\}\]\[\mathscr{Y}_b =
\{\mathbf{Y}_{b,1}, \ldots, \mathbf{Y}_{b,N}\}\] determine the
relative camera pose \(\mathbf{T}_{ab}\)
3D geometric error: \[\boxed{E(\mathbf{T}_{ab}) = \sum_{i=1}^N \|
\mathbf{Y}_{a,i} - \mathbf{T}_{ab} \mathbf{Y}_{b,i}\|^2}\]
Corresponds to least-squares point cloud alignment.
Closed-form solutions available, e.g. Arun et al., 1987
Applications:
Relative pose for calibrated stereo cameras (triangulation of 3D
points) or RGB-D cameras (measured depth)
Loop-closure correction (variant with scale estimate available for
monocular SLAM)
Place Recognition
Place Recognition with Bag of Words
Place recognition aims to find similar images to a given query image
SfM: Which images to match?
SLAM: Detect loops
Idea: Discretize the feature-descriptor space by hierarchical
clustering in a “vocabulary tree”
visual “words” correspond to leaf-nodes
words are weighted by distinctiveness: e.g. “inverse document
frequency” \(\log(N/N_i)\)
Image comparison:
each feature is assigned to a word by passing it down the tree
for an image, count occurrence of each word (“term frequency”):
bag-of-words vector
to compare images, compute the distance of (normalized) bag-of-words
vectors
close bag-of-words vectors correspond to potentially similar
images
Vocabulary tree and weights are built offline from large collection
of features
False positives possible: Combine with geometric, temporal, …
consistency checks
Nistér & Stewénius, CVPR
2006
Efficient Query and Feature Matching
Image query with “inverse index”:
For each word store list of images, and for each image cache the
word count.
During query, consider only images from the inverse index of each
word