Nima Kalantari
CSCE 448/748 - Computational Photography
Automatic Image Alignment and RANSAC
Slides from Alexei A. Efros, James Hays, Richard Szeliski, and Steve Seitz
Image Alignment
How do we align two images automatically?
Two broad approaches:
Feature-based alignment
Feature-based alignment
Feature detection
How do we choose good features automatically?
Example
Feature detection
How do we choose good features automatically?
Feature-based alignment
Feature-based alignment
Feature Matching
How do we match the features between the images?
Issues:
Invariant Feature Descriptors
Schmid & Mohr 1997, Lowe 1999, Baumberg 2000, Tuytelaars & Van Gool 2000, Mikolajczyk & Schmid 2001, Brown & Lowe 2002, Matas et. al. 2002, Schaffalitzky & Zisserman 2002
Invariant Local Features
Image content is transformed into local feature coordinates that are invariant to translation, rotation, scale, and other imaging parameters
Features Descriptors
Applications
Feature points are used for:
Feature-based alignment
Feature-based alignment
Computing transformation
Outline
Reading:
Multi-image Matching using Multi-scale image patches, CVPR 2005
Outline
Harris corner detector
C.Harris, M.Stephens. “A Combined Corner and Edge Detector”. 1988
The Basic Idea
We should easily recognize the point by looking through a small window
Shifting a window in any direction should give a large change in intensity
Harris Detector: Basic Idea
“flat” region:�no change in all directions
“edge”:�no change along the edge direction
“corner”:�significant change in all directions
Harris Detector: Mathematics
Change of intensity for the shift [u,v]:
Intensity
Shifted intensity
Window function
or
Window function w(x,y) =
Gaussian
1 in window, 0 outside
Error surface
Harris Detector: Mathematics
For small shifts [u,v] we can use Taylor Series expansion to get:
where M is a 2×2 matrix computed from image derivatives:
Slide from Kavita Bala
Harris Detector
The Algorithm:
Harris Detector: Mathematics
Measure of corner response:
(k – empirical constant, k = 0.04-0.06)
Harris Detector: Workflow
Harris Detector: Workflow
Compute corner response R
Harris Detector
The Algorithm:
Harris Detector: Workflow
Find points with large corner response: R>threshold
Harris Detector
The Algorithm:
Harris Detector: Workflow
Take only the points of local maxima of R
Harris Detector: Workflow
Harris Detector: Some Properties
Rotation invariance
Corner response R is invariant to image rotation
Harris Detector: Some Properties
Intensity scale: I → a I
R
x (image coordinate)
threshold
R
x (image coordinate)
Corner response R is partially invariant to intensity scale
Harris Detector: Some Properties
But: non-invariant to image scale!
All points will be classified as edges
Corner !
Scale Invariant Detection
Consider regions (e.g. circles) of different sizes around a point
Regions of corresponding sizes will look the same in both images
Scale Invariant Detection
The problem: how do we choose corresponding circles independently in each image?
Choose the scale of the “best” corner
Feature selection
Feature selection
Adaptive Non-maximal Suppression
Desired: Fixed # of features per image
Outline
Outline
Feature descriptors
We know how to detect points
Next question: How to match them?
?
Point descriptor should be:
Multi-Scale Oriented Patches (MOPS)
Find local orientation
Dominant direction of gradient
Detect Features, setup Frame
Orientation = blurred gradient
Rotation Invariant Frame
MOPS descriptor vector
8x8 oriented patch
Bias/gain normalisation: I’ = (I – μ)/σ
8 pixels
40 pixels
Outline
Outline
Feature matching
?
Feature matching
Given a feature in I1, how to find the best match in I2?
Feature distance
How to define the difference between two features f1, f2?
I1
I2
f1
f2
Feature distance
How to define the difference between two features f1, f2?
I1
I2
f1
f2
f2'
Feature-space outliner rejection
Can we now compute H from the blue points?
Outline
Outline
Matching features
What do we do about the “bad” matches?
RANSAC
Algorithm:
Repeat 1-3 until the best model is found with high confidence
Fischler & Bolles in ‘81.
(RANdom SAmple Consensus) :
RANSAC
Algorithm:
Repeat 1-3 until the best model is found with high confidence
Illustration by Savarese
Line fitting example
RANSAC
Algorithm:
Repeat 1-3 until the best model is found with high confidence
Line fitting example
RANSAC
Algorithm:
Repeat 1-3 until the best model is found with high confidence
Line fitting example
RANSAC
Algorithm:
Repeat 1-3 until the best model is found with high confidence
RANSAC for estimating homography
RANSAC loop:
RANSAC
Alignment
Blending