Image Stitching. Slides from Rick Szeliski, Steve Seitz, Derek Hoiem, Ira Kemelmacher, Ali Farhadi

Similar documents
Mosaics. Today s Readings

Feature Matching and RANSAC

Homographies and RANSAC

Announcements. Mosaics. How to do it? Image Mosaics

CS4670: Computer Vision

Announcements. Mosaics. Image Mosaics. How to do it? Basic Procedure Take a sequence of images from the same position =

CS6670: Computer Vision

Image warping and stitching

Image warping and stitching

Image Warping and Mosacing

Image warping and stitching

Introduction to Computer Vision. Week 3, Fall 2010 Instructor: Prof. Ko Nishino

Image stitching. Announcements. Outline. Image stitching

Image stitching. Digital Visual Effects Yung-Yu Chuang. with slides by Richard Szeliski, Steve Seitz, Matthew Brown and Vaclav Hlavac

Image stitching. Digital Visual Effects Yung-Yu Chuang. with slides by Richard Szeliski, Steve Seitz, Matthew Brown and Vaclav Hlavac

Automatic Image Alignment (feature-based)

Automatic Image Alignment

Today s lecture. Image Alignment and Stitching. Readings. Motion models

EE795: Computer Vision and Intelligent Systems

Automatic Image Alignment

EE795: Computer Vision and Intelligent Systems

Stitching and Blending

Image-based Modeling and Rendering: 8. Image Transformation and Panorama

Image Warping. Many slides from Alyosha Efros + Steve Seitz. Photo by Sean Carroll

N-Views (1) Homographies and Projection

CSE 527: Introduction to Computer Vision

CS 2770: Intro to Computer Vision. Multiple Views. Prof. Adriana Kovashka University of Pittsburgh March 14, 2017

Midterm Examination CS 534: Computational Photography

CS4670: Computer Vision

Feature Based Registration - Image Alignment

Recap. DoF Constraint Solver. translation. affine. homography. 3D rotation

The SIFT (Scale Invariant Feature

Local features and image matching May 8 th, 2018

CS5670: Computer Vision

Automatic Image Alignment (direct) with a lot of slides stolen from Steve Seitz and Rick Szeliski

More Mosaic Madness. CS194: Image Manipulation & Computational Photography. Steve Seitz and Rick Szeliski. Jeffrey Martin (jeffrey-martin.

Object Recognition with Invariant Features

Epipolar Geometry and Stereo Vision

Chapter 3 Image Registration. Chapter 3 Image Registration

Local Feature Detectors

Global Flow Estimation. Lecture 9

Affine and Projective Transformations

Local features and image matching. Prof. Xin Yang HUST

E27 Computer Vision - Final Project: Creating Panoramas David Nahmias, Dan Spagnolo, Vincent Stigliani Professor Zucker Due 5/10/13

Instance-level recognition

Prof. Feng Liu. Spring /26/2017

Image warping , , Computational Photography Fall 2017, Lecture 10

Warping. 12 May 2015

Computer Vision. Recap: Smoothing with a Gaussian. Recap: Effect of σ on derivatives. Computer Science Tripos Part II. Dr Christopher Town

Local features: detection and description. Local invariant features

Local features: detection and description May 12 th, 2015

Instance-level recognition

Image correspondences and structure from motion

Targil 10 : Why Mosaic? Why is this a challenge? Exposure differences Scene illumination Miss-registration Moving objects

6.098 Digital and Computational Photography Advanced Computational Photography. Panoramas. Bill Freeman Frédo Durand MIT - EECS

Global Flow Estimation. Lecture 9

Homework #4: Creating Panoramas

Index. 3D reconstruction, point algorithm, point algorithm, point algorithm, point algorithm, 263

Model Fitting. Introduction to Computer Vision CSE 152 Lecture 11

Photo by Carl Warner

Agenda. Rotations. Camera calibration. Homography. Ransac

Agenda. Rotations. Camera models. Camera calibration. Homographies

Epipolar Geometry and Stereo Vision

Image warping/morphing

Dense Image-based Motion Estimation Algorithms & Optical Flow

Index. 3D reconstruction, point algorithm, point algorithm, point algorithm, point algorithm, 253

CS 1674: Intro to Computer Vision. Midterm Review. Prof. Adriana Kovashka University of Pittsburgh October 10, 2016

Stereo and Epipolar geometry

Computational Optical Imaging - Optique Numerique. -- Multiple View Geometry and Stereo --

Overview. Video. Overview 4/7/2008. Optical flow. Why estimate motion? Motion estimation: Optical flow. Motion Magnification Colorization.

Panoramic Image Stitching

Panoramas. Why Mosaic? Why Mosaic? Mosaics: stitching images together. Why Mosaic? Olivier Gondry. Bill Freeman Frédo Durand MIT - EECS

Local Features: Detection, Description & Matching

Wikipedia - Mysid

BSB663 Image Processing Pinar Duygulu. Slides are adapted from Selim Aksoy

Multi-stable Perception. Necker Cube

calibrated coordinates Linear transformation pixel coordinates

Feature Tracking and Optical Flow

Midterm Wed. Local features: detection and description. Today. Last time. Local features: main components. Goal: interest operator repeatability

Computational Optical Imaging - Optique Numerique. -- Single and Multiple View Geometry, Stereo matching --

Feature Tracking and Optical Flow

CSE 252B: Computer Vision II

Augmented Reality VU. Computer Vision 3D Registration (2) Prof. Vincent Lepetit

Object Recognition and Augmented Reality

Harder case. Image matching. Even harder case. Harder still? by Diva Sian. by swashford

EE795: Computer Vision and Intelligent Systems

Structure from Motion

Chaplin, Modern Times, 1936

CS 231A Computer Vision (Winter 2014) Problem Set 3

SURF applied in Panorama Image Stitching

Automatic Panoramic Image Stitching. Dr. Matthew Brown, University of Bath

Instance-level recognition part 2

Overview. Augmented reality and applications Marker-based augmented reality. Camera model. Binary markers Textured planar markers

Structure from Motion. Introduction to Computer Vision CSE 152 Lecture 10

CS664 Lecture #16: Image registration, robust statistics, motion

Introduction to Computer Vision

CS4670: Computer Vision

CS 558: Computer Vision 4 th Set of Notes

Harder case. Image matching. Even harder case. Harder still? by Diva Sian. by swashford

Building a Panorama. Matching features. Matching with Features. How do we build a panorama? Computational Photography, 6.882

Transcription:

Image Stitching Slides from Rick Szeliski, Steve Seitz, Derek Hoiem, Ira Kemelmacher, Ali Farhadi

Combine two or more overlapping images to make one larger image Add example Slide credit: Vaibhav Vaish

How to do it? Basic Procedure 1. Take a sequence of images from the same position 1. Rotate the camera about its optical center 2. Compute transformation between second image and first 3. Shift the second image to overlap with the first 4. Blend the two together to create a mosaic 5. If there are more images, repeat

1. Take a sequence of images from the same position Rotate the camera about its optical center

2. Compute transformation between images Extract interest points Find Matches (are they all correct?) Compute transformation?

3. Shift the images to overlap

4. Blend the two together to create a mosaic

5. Repeat for all images

How to do it? Basic Procedure 1. Take a sequence of images from the same position 1. Rotate the camera about its optical center 2. Compute transformation between second image and first 3. Shift the second image to overlap with the first 4. Blend the two together to create a mosaic 5. If there are more images, repeat

Compute Transformations Extract interest points Find good matches Compute transformation Let s assume we are given a set of good matching interest points

Image reprojection mosaic PP The mosaic has a natural interpretation in 3D The images are reprojected onto a common plane The mosaic is formed on this plane

Example Camera Center

Image reprojection Observation Rather than thinking of this as a 3D reprojection, think of it as a 2D image warp from one image to another

Motion models What happens when we take two images with a camera and try to align them? translation? rotation? scale? affine? Perspective?

Projective transformations (aka homographies) homogeneous coordinates

Parametric (global) warping Examples of parametric warps: translation rotation aspect affine perspective

2D coordinate transformations translation: x = x + t x = (x,y) add rotation: x = R x + t similarity: affine: x = s R x + t x = A x + t perspective: x H x x = (x,y,1) (x is in homogeneous coordinates)

Image Warping Given a coordinate transform x = h(x) and a source image f(x), how do we compute a transformed image g(x ) = f(h(x))? h(x) x x f(x) g(x )

Forward Warping Send each pixel f(x) to its corresponding location x = h(x) in g(x ) What if pixel lands between two pixels? h(x) x x f(x) g(x )

Forward Warping Send each pixel f(x) to its corresponding location x = h(x) in g(x ) What if pixel lands between two pixels? Answer: add contribution to several pixels, normalize later (splatting) awkward h(x) x x f(x) g(x )

Inverse Warping Get each pixel g(x ) from its corresponding location x = h(x) in f(x) What if pixel comes from between two pixels? h -1 (x) x x f(x) g(x ) Richard Szeliski Image Stitching 21

Inverse Warping Get each pixel g(x ) from its corresponding location x = h(x) in f(x) What if pixel comes from between two pixels? Answer: resample color value from interpolated source image h -1 (x) x x f(x) g(x ) Richard Szeliski Image Stitching 22

Interpolation Possible interpolation filters: nearest neighbor bilinear bicubic (interpolating)

Related: Descriptors 11/2/2015 24

Implementation Concern: How do you rotate a patch? Start with an empty patch whose dominant direction is up. For each pixel in your patch, compute the position in the detected image patch. It will be in floating point and will fall between the image pixels. Interpolate the values of the 4 closest pixels in the image, to get a value for the pixel in your patch. 11/2/2015 25

Using Bilinear Interpolation Use all 4 adjacent pixels, weighted. I 01 I 11 y I 00 I 10 x 11/2/2015 26

Transformation models Translation Affine Perspective 2 unknowns 6 unknowns 8 unknowns

Finding the transformation Translation = 2 degrees of freedom Similarity = 4 degrees of freedom Affine = 6 degrees of freedom Homography = 8 degrees of freedom How many corresponding points do we need to solve?

Simple case: translations How do we solve for?

Simple case: translations Displacement of match i = Mean displacement =

Simple case: translations System of linear equations What are the knowns? Unknowns? How many unknowns? How many equations (per match)?

Simple case: translations Problem: more equations than unknowns Overdetermined system of equations We will find the least squares solution

Least squares formulation For each point we define the residuals as

Least squares formulation Goal: minimize sum of squared residuals Least squares solution For translations, is equal to mean displacement

Least squares Find t that minimizes To solve, form the normal equations

Solving for translations Using least squares 2n x 2 2 x 1 2n x 1

Affine transformations How many unknowns? How many equations per match? How many matches do we need?

Affine transformations Residuals: Cost function:

Affine transformations Matrix form 2n x 6 6 x 1 2n x 1

Solving for homographies

Solving for homographies

Direct Linear Transforms 2n 9 9 2n Defines a least squares problem: Since is only defined up to scale, solve for unit vector Solution: = eigenvector of with smallest eigenvalue Works with 4 or more points

Matching features What do we do about the bad matches? Richard Szeliski Image Stitching 44

RAndom SAmple Consensus Select one match, count inliers Richard Szeliski Image Stitching 45

RAndom SAmple Consensus Select one match, count inliers Richard Szeliski Image Stitching 46

Least squares fit Find average translation vector Richard Szeliski Image Stitching 47

RANSAC for estimating homography RANSAC loop: 1. Select four feature pairs (at random) 2. Compute homography H (exact) 3. Compute inliers where p i, H p i < ε Keep largest set of inliers Re-compute least-squares H estimate using all of the inliers CSE 576, Spring 2008 Structure from Motion 49

Simple example: fit a line Rather than homography H (8 numbers) fit y=ax+b (2 numbers a, b) to 2D pairs 50 50

Simple example: fit a line Pick 2 points Fit line Count inliers 3 inliers 51 51

Simple example: fit a line Pick 2 points Fit line Count inliers 4 inliers 52 52

Simple example: fit a line Pick 2 points Fit line Count inliers 9 inliers 53 53

Simple example: fit a line Pick 2 points Fit line Count inliers 8 inliers 54 54

Simple example: fit a line Use biggest set of inliers Do least-square fit 55 55

RANSAC Red: rejected by 2nd nearest neighbor criterion Blue: Ransac outliers Yellow: inliers

Computing homography Assume we have four matched points: How do we compute homography H? Normalized DLT (direct linear transformation) 1. Normalize coordinates for each image a) Translate for zero mean b) Scale so that average distance to origin is ~sqrt(2) ~ x = Tx ~ x = T x This makes problem better behaved numerically 2. Compute using DLT in normalized coordinates 3. Unnormalize: H ~ H = T 1 ~ HT x i = Hx i

HZ Tutorial 99 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: x i = Hx i 5. Count points with projected distance < t E.g., t = 3 pixels 6. Repeat steps 2-5 N times Choose H with most inliers

Automatic Image Stitching 1. Compute interest points on each image 2. Find candidate matches 3. Estimate homography H using matched points and RANSAC with normalized DLT 4. Project each image onto the same surface and blend

RANSAC for Homography Initial Matched Points

RANSAC for Homography Final Matched Points

RANSAC for Homography

Image Blending

Feathering + 1 0 1 0 =

Pyramid blending Create a Laplacian pyramid, blend each level Burt, P. J. and Adelson, E. H., A multiresolution spline with applications to image mosaics, ACM Transactions on Graphics, 42(4), October 1983, 217-236.

Poisson Image Editing For more info: Perez et al, SIGGRAPH 2003 http://research.microsoft.com/vision/cambridge/papers/perez_siggraph03.pdf

Recognizing Panoramas Some of following material from Brown and Lowe 2003 talk Brown and Lowe 2003, 2007

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 H ij 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 H ij for each matched image c) Decide if match is valid (n i > 8 + 0.3 n f ) # inliers # keypoints in overlapping area

Recognizing Panoramas (cont.) (now we have matched pairs of images) 4. Find connected components

Finding the panoramas

Finding the panoramas

Finding the panoramas

Recognizing Panoramas (cont.) (now we have matched pairs of images) 4. Find connected components 5. For each connected component a) Solve for rotation and f b) Project to a surface (plane, cylinder, or sphere) c) Render with multiband blending