RANSAC and mosaic wrapup Jeffrey Martin jeffreymartin com





![Feature-space outlier rejection A better way [Lowe, 1999]: • • 1 -NN: SSD of Feature-space outlier rejection A better way [Lowe, 1999]: • • 1 -NN: SSD of](https://slidetodoc.com/presentation_image_h2/ab892bcf1e83523034b1d68c38f511d4/image-6.jpg)





















- Slides: 27

RANSAC and mosaic wrap-up © Jeffrey Martin (jeffrey-martin. com) most slides from Steve Seitz, Rick Szeliski, and Alexei A. Efros cs 129: Computational Photography James Hays, Brown, Spring 2011

Feature matching ?

Feature matching • Exhaustive search • for each feature in one image, look at all the other features in the other image(s) • Hashing • compute a short descriptor from each feature vector, or hash longer descriptors (randomly) • Nearest neighbor techniques • kd-trees and their variants

What about outliers? ?

Feature-space outlier rejection Let’s not match all features, but only these that have “similar enough” matches? How can we do it? • SSD(patch 1, patch 2) < threshold • How to set threshold?
![Featurespace outlier rejection A better way Lowe 1999 1 NN SSD of Feature-space outlier rejection A better way [Lowe, 1999]: • • 1 -NN: SSD of](https://slidetodoc.com/presentation_image_h2/ab892bcf1e83523034b1d68c38f511d4/image-6.jpg)
Feature-space outlier rejection A better way [Lowe, 1999]: • • 1 -NN: SSD of the closest match 2 -NN: SSD of the second-closest match Look at how much better 1 -NN is than 2 -NN, e. g. 1 -NN/2 -NN That is, is our best match so much better than the rest?

Feature-space outliner rejection Can we now compute H from the blue points? • No! Still too many outliers… • What can we do?

Matching features What do we do about the “bad” matches?

RANdom SAmple Consensus Select one match, count inliers

RANdom SAmple Consensus Select one match, count inliers

Least squares fit Find “average” translation vector

RANSAC for estimating homography RANSAC loop: 1. Select four feature pairs (at random) 2. Compute homography H (exact) 3. Compute inliers where SSD(pi’, H pi) < ε 4. Keep largest set of inliers 5. Re-compute least-squares H estimate on all of the inliers

RANSAC The key idea is not just that there are more inliers than outliers, but that the outliers are wrong in different ways.

RANSAC

Mosaic odds and ends

Do we have to project onto a plane? mosaic PP


Full Panoramas What if you want a 360 field of view? mosaic Projection Cylinder

Cylindrical projection • Map 3 D point (X, Y, Z) onto cylinder Y Z X unit cylinder • Convert to cylindrical coordinates • Convert to cylindrical image coordinates unwrapped cylinder cylindrical image

Cylindrical Projection Y X

Cylindrical panoramas Steps • Reproject each image onto a cylinder • Blend • Output the resulting mosaic

Cylindrical image stitching What if you don’t know the camera rotation? • Solve for the camera rotations – Note that a rotation of the camera is a translation of the cylinder!

Assembling the panorama Stitch pairs together, blend, then crop

Problem: Drift Vertical Error accumulation • small (vertical) errors accumulate over time • apply correction so that sum = 0 (for 360° pan. ) Horizontal Error accumulation • can reuse first/last image to find the right panorama radius

Full-view (360°) panoramas

Cylindrical reprojection top-down view Image 384 x 300 Focal length – the dirty secret… f = 180 (pixels) f = 280 f = 380

What’s your focal length, buddy? Focal length is (highly!) camera dependant • Can get a rough estimate by measuring FOV: • Can use the EXIF data tag (might not give the right thing) • Can use several images together and try to find f that would make them match • Can use a known 3 D object and its projection to solve for f • Etc. There are other camera parameters too: • Optical center, non-square pixels, lens distortion, etc.