Photo Stitching
Photo Stitching
Photo Stitching
Image Stitching
Computational Photography
Derek Hoiem, University of Illinois
Photos by Russ Hewett
A2
2. Define a region
around each
keypoint
A3
fA
fB
d( f A, fB ) T
3. Extract and
normalize the
region content
4. Compute a local
descriptor from the
normalized region
5. Match local
descriptors
K. Grauman, B. Leibe
Add example
Problem basics
Do on board
Basic problem
x = K [R t] X
x = K [R t] X
t=t=0
.X
x
x'
f
f'
x=Hx where
H = K R R-1 K-1
Typically only R and f will change (4 parameters),
but, in general, H has 8 parameters
Camera Center
Computing homography
Assume we have four matched points: How do
we compute homography H?
Direct Linear Transformation (DLT)
x' Hx
w' u'
x ' w' v'
w'
h1
H h4
h7
h2
h5
h8
h3
h6
h9
0
0 uu vu u
u v 1 0
h0
0
0
0 u v 1 uv vv v
h1
h
2
h3
h4
h h5
h6
h7
h8
h
9
Computing homography
Direct Linear Transform
0
0 u1u1 v1u1 u1
u1 v1 1 0
0
0
0 u1 v1 1 u1v1 v1v1 v1
h 0 Ah 0
0
0
0
1
u
v
v
v
v
n
n
n n
n n
n
h7
h9
h2
h5
h8
h3
h6
h9
Matlab
[U, S, V] = svd(A);
h = V(:, end);
Computing homography
Assume we have four matched points: How do
we compute homography H?
Normalized DLT
1. Normalize coordinates for each image
a) Translate for zero mean
b) Scale so that u and v are ~=1 on average
~
x Tx
~x Tx
Computing homography
Assume we have matched points with outliers:
How do we compute homography H?
Automatic Homography Estimation with RANSAC
Repeat N times
1. Randomly select a sample
Select just enough points to recover the parameters
2. Fit the model with random sample
Computing homography
Assume we have matched points with outliers: How do
we compute homography H?
Automatic Homography Estimation with RANSAC
1. Choose number of samples N
2. Choose 4 random potential matches
3. Compute H using normalized DLT
4. Project points from x to x for each potentially
matching pair: xi Hx i
5. Count points with projected distance < t
E.g., t = 3 pixels
Planar Mapping
x
x
Planar
Photos by Russ Hewett
Cylindrical Mapping
x
x
f
Planar
Cylindrical
Recognizing Panoramas
Recognizing Panoramas
Input: N images
1. Extract SIFT points, descriptors from all
images
2. Find K-nearest neighbors for each point (K=4)
3. For each image
a) Select M candidate matching images by counting
matched keypoints (M=6)
b) Solve homography Hij for each matched image
Recognizing Panoramas
Input: N images
1. Extract SIFT points, descriptors from all
images
2. Find K-nearest neighbors for each point (K=4)
3. For each image
a) Select M candidate matching images by counting
matched keypoints (M=6)
b) Solve homography Hij for each matched image
c) Decide if match is valid (ni > 8 + 0.3 nf )
# inliers
# keypoints in
overlapping area
Verification
Mi
error dist (x , x )
k
Bundle Adjustment
New images initialized with rotation, focal
length of the best matching image
Bundle Adjustment
New images initialized with rotation, focal
length of the best matching image
Blending
Gain compensation: minimize intensity
difference of overlapping pixels
Blending
Pixels near center of image get more weight
Multiband blending to prevent blurring
Multiband blending
Blending Comparison
Straightening
Rectify images so that up is vertical
Further reading
Harley and Zisserman: Multi-view Geometry book
Caution
Distortion in lens (Pin Cushion, Barrel, and Fisheye)
Polarizing filters
Sharpness in image edge / overlap region
Howth, Ireland
Handheld Camera
Handheld Camera
Macro
Side of Laptop
Gibson City, IL
Mount Blanca, CO
Mount Blanca, CO
Things to remember
Homography relates rotating cameras
Recover homography using RANSAC and
normalized DLT
Can choose surface of projection: cylinder,
plane, and sphere are most common
Lots of room for tweaking (blending,
straightening, etc.)
Next class
Using interest points to find objects in
datasets