Lect 7
Lect 7
VR Seattle: http://www.vrseattle.com/
Full screen panoramas (cubic): http://www.panoramas.dk/
Mars: http://www.panoramas.dk/fullscreen3/f2_mars97.html
Today’s Readings
• Szeliski and Shum paper (sections 1 and 2, skim the rest)
– http://www.cs.washington.edu/education/courses/455/08wi/readings/szeliskiShum97.pdf
Image Mosaics
+ + … + =
Goal
• Stitch together several images into a seamless composite
How to do it?
Basic Procedure
• Take a sequence of images from the same position
– Rotate the camera about its optical center
• Compute transformation between second image and first
• Shift the second image to overlap with the first
• Blend the two together to create a mosaic
• If there are more images, repeat
Project 2
1. Take pictures on a tripod (or handheld)
2. Warp to spherical coordinates
3. Extract features
4. Align neighboring pairs using RANSAC
5. Write out list of neighboring translations
6. Correct for drift
7. Read in warped images and blend them
8. Crop the result and import into a viewer
mosaic PP
PP2
Answer
• Cast a ray through each pixel in PP1
• Draw the pixel where that ray intersects PP2
PP1
Observation
• Rather than thinking of this as a 3D reprojection, think of it
as a 2D image warp from one image to another
Homographies
Perspective projection of a plane
• Lots of names for this:
– homography, texture-map, colineation, planar projective map
• Modeled as a 2D warp using homogeneous coordinates
wx' * * * x
wy' * * * y
w * * * 1
p’ H p
To apply a homography H
• Compute p’ = Hp (regular matrix multiply)
• Convert p’ from homogeneous to image coordinates
– divide by w (third) coordinate
Image warping with homographies
Y
Z X • Convert to spherical coordinates
unwrapped sphere
Spherical image
Spherical reprojection
How to map sphere onto a flat image?
• to
Y
Z X
side view
top-down view
Spherical reprojection
How to map sphere onto a flat image?
• to
– Use image projection matrix!
– or use the version of projection that properly
Y
accounts for radial distortion, as discussed in
Z X
projection slides. This is what you’ll do for
project 2.
side view
top-down view
Correcting radial distortion
Project
to “normalized”
image coordinates
• The trace is the sum of the diagonals, i.e., trace(H) = h11 + h22
• Very similar to - but less expensive (no square root)
• Called the “Harris Corner Detector” or “Harris Operator”
• Lots of other detectors, this is one of the most popular
The Harris operator
Harris
operator
Multiscale Oriented PatcheS descriptor
Take 40x40 square window around detected feature
• Scale to 1/5 size (using prefiltering)
• Rotate to horizontal
• Sample 8x8 square window centered at feature
• Intensity normalize the window by subtracting the mean, dividing by
the standard deviation in the window
40 p
ixels 8 pixels
f1 f2
I1 I2
Feature distance
How to define the difference between two features f1, f2?
• Better approach: ratio distance = SSD(f1, f2) / SSD(f1, f2’)
– f2 is best SSD match to f1 in I2
– f2 ’ is 2nd best SSD match to f1 in I2
– gives small values for ambiguous matches
f1 f2' f2
I1 I2
Evaluating the results
How can we measure the performance of a feature matcher?
50
75
200
feature distance
Computing image translations
General version
• Randomly choose a set of K correspondences
– Typically K is the minimum size that lets you fit a model
• Fit a model (e.g., homography) to those correspondences
• Count the number of inliers that “approximately” fit the model
– Need a threshold on the error
• Repeat as many times as you can
• Choose the model that has the largest set of inliers
• Refine the model by doing a least squares fit using ALL of
the inliers
Project 2
1. Take pictures on a tripod (or handheld)
2. Warp to spherical coordinates
3. Extract features
4. Align neighboring pairs using RANSAC
5. Write out list of neighboring translations
6. Correct for drift
7. Read in warped images and blend them
8. Crop the result and import into a viewer
Error accumulation
• small errors accumulate over time
Project 2
1. Take pictures on a tripod (or handheld)
2. Warp to spherical coordinates
3. Extract features
4. Align neighboring pairs using RANSAC
5. Write out list of neighboring translations
6. Correct for drift
7. Read in warped images and blend them
8. Crop the result and import into a viewer
(x1,y1)
(xn,yn)
Solution
• add another copy of first image at the end
• this gives a constraint: yn = y1
• there are a bunch of ways to solve this problem
– add displacement of (y1 – yn)/(n -1) to each image after the first
– compute a global warp: y’ = y + ax
– run a big optimization problem, incorporating this constraint
» best solution, but more complicated
» known as “bundle adjustment”
Full-view Panorama
+ +
+ +
Different projections are possible
Image Blending
Project 2
1. Take pictures on a tripod (or handheld)
2. Warp to spherical coordinates
3. Extract features
4. Align neighboring pairs using RANSAC
5. Write out list of neighboring translations
6. Correct for drift
7. Read in warped images and blend them
8. Crop the result and import into a viewer
+
1 1
0 0
=
Effect of window size
1 left 1
right
0 0
Effect of window size
1 1
0 0
Good window size
I1
Optional: see Blinn (CGA, 1994) for details:
http://ieeexplore.ieee.org/iel1/38/7531/00310740.pdf?isNumb
er=7531&prod=JNL&arnumber=310740&arSt=83&ared=87&a
I2 rAuthor=Blinn%2C+J.F.
h(x,y)
y y’
x x’
f(x,y) g(x’,y’)
h(x,y)
y y’
x x’
f(x,y) g(x’,y’)
h(x,y)
y y’
x x’
f(x,y) g(x’,y’)
h-1(x,y)
y y’
x x’
f(x,y) g(x’,y’)
h-1(x,y)
y y’
x x’
f(x,y) g(x’,y’)