Image Stitching Linda Shapiro ECE P 596.

Slides:



Advertisements
Similar presentations
Image alignment Image from
Advertisements

Image alignment Image from
Mosaics con’t CSE 455, Winter 2010 February 10, 2010.
Lecture 11: Transformations CS4670/5760: Computer Vision Kavita Bala.
Lecture 8: Geometric transformations CS4670: Computer Vision Noah Snavely.
Image Warping : Computational Photography Alexei Efros, CMU, Fall 2005 Some slides from Steve Seitz
Epipolar geometry. (i)Correspondence geometry: Given an image point x in the first view, how does this constrain the position of the corresponding point.
Lecture 7: Image Alignment and Panoramas CS6670: Computer Vision Noah Snavely What’s inside your fridge?
Lecture 6: Image transformations and alignment CS6670: Computer Vision Noah Snavely.
Lecture 9: Image alignment CS4670: Computer Vision Noah Snavely
Optical Flow Estimation
Lecture 8: Image Alignment and RANSAC
Image Warping and Mosacing : Rendering and Image Processing Alexei Efros …with a lot of slides stolen from Steve Seitz and Rick Szeliski.
Computational Photography: Image Registration Jinxiang Chai.
Lecture 10: Robust fitting CS4670: Computer Vision Noah Snavely.
CSCE 641 Computer Graphics: Image Registration Jinxiang Chai.
Announcements Project 1 artifact voting Project 2 out today (help session at end of class)
Computing transformations Prof. Noah Snavely CS1114
Image warping/morphing Digital Video Special Effects Fall /10/17 with slides by Y.Y. Chuang,Richard Szeliski, Steve Seitz and Alexei Efros.
Image Stitching Ali Farhadi CSEP 576 Several slides from Rick Szeliski, Steve Seitz, Derek Hoiem, and Ira Kemelmacher.
Announcements Midterm due Friday, beginning of lecture Guest lecture on Friday: Antonio Criminisi, Microsoft Research.
Image Stitching Ali Farhadi CSE 455
CSC 589 Lecture 22 Image Alignment and least square methods Bei Xiao American University April 13.
Lecture 12: Image alignment CS4670/5760: Computer Vision Kavita Bala
Homogeneous Coordinates (Projective Space) Let be a point in Euclidean space Change to homogeneous coordinates: Defined up to scale: Can go back to non-homogeneous.
Mosaics Today’s Readings Szeliski, Ch 5.1, 8.1 StreetView.
Image stitching Digital Visual Effects Yung-Yu Chuang with slides by Richard Szeliski, Steve Seitz, Matthew Brown and Vaclav Hlavac.
Image Stitching Ali Farhadi CSE 576 Several slides from Rick Szeliski, Steve Seitz, Derek Hoiem, and Ira Kemelmacher.
Computer Vision : CISC 4/689 Going Back a little Cameras.ppt.
Reconnaissance d’objets et vision artificielle Jean Ponce Equipe-projet WILLOW ENS/INRIA/CNRS UMR 8548 Laboratoire.
Mosaics part 3 CSE 455, Winter 2010 February 12, 2010.
ELE 488 Fall 2006 Image Processing and Transmission ( )
776 Computer Vision Jan-Michael Frahm Spring 2012.
Mosaics Today’s Readings Szeliski and Shum paper (sections 1 and 2, skim the rest) –
CS559: Computer Graphics Lecture 7: Image Warping and Panorama Li Zhang Spring 2008 Most slides borrowed from Yungyu ChuangYungyu Chuang.
Lecture 15: Transforms and Alignment CS4670/5670: Computer Vision Kavita Bala.
Image Stitching Computer Vision CS 691E Some slides from Richard Szeliski.
Image Warping 2D Geometric Transformations
Lecture 10: Image alignment CS4670/5760: Computer Vision Noah Snavely
776 Computer Vision Jan-Michael Frahm Spring 2012.
Lecture 16: Image alignment
Prof. Adriana Kovashka University of Pittsburgh October 3, 2016
CS4670 / 5670: Computer Vision Kavita Bala Lecture 20: Panoramas.
CPSC 641: Image Registration
COSC579: Image Align, Mosaic, Stitch
Motion and Optical Flow
Homogeneous Coordinates (Projective Space)
Lecture 7: Image alignment
RANSAC and mosaic wrap-up
A special case of calibration
Image Stitching Slides from Rick Szeliski, Steve Seitz, Derek Hoiem, Ira Kemelmacher, Ali Farhadi.
CSCE 441: Computer Graphics Image Warping
Object recognition Prof. Graeme Bailey
Idea: projecting images onto a common plane
Announcements Project 2 out today (help session at end of class)
Feature Matching and RANSAC
2D transformations (a.k.a. warping)
Image Stitching Computer Vision CS 678
Announcements Project 1 Project 2 Vote for your favorite artifacts!
Announcements Project 1 artifact voting Project 2 out today
Lecture 8: Image alignment
Lecture 8: Image alignment
Computational Photography
Calibration and homographies
Back to equations of geometric transformations
CS5760: Computer Vision Lecture 9: RANSAC Noah Snavely
CS5760: Computer Vision Lecture 9: RANSAC Noah Snavely
Image Stitching Linda Shapiro ECE/CSE 576.
Lecture 11: Image alignment, Part 2
Presentation transcript:

Image Stitching Linda Shapiro ECE P 596

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

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

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 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 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 ✓

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 The mosaic has a natural interpretation in 3D 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?

Recall: Projective transformations (aka homographies)

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

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

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) 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’)

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’)

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

Bilinear Interpolation

Motion models Translation 2 unknowns Affine 6 unknowns Perspective

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 =

Example (2,2) 9,2 8,1) (1,1) ((9-2)+(8-1))/2 , ((2-2) +(1-1)/2 = 7, 0

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

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

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

Our Example A t = b 1 0 0 1 7 Xt Yt = 1 0 1 0 0 1 0 1 1 0 0 1 2 0 0 2 .5 0 0 .5 1 0 1 0 0 1 0 1 .5 0 .5 0 0 .5 0 .5 = = Inverse = Transpose 7 7 .5 0 .5 0 0 .5 0 .5 =

Affine transformations How many unknowns? How many equations per match? x´ = ax + by + c; y´ = dx + ey +f 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 Why is this now a variable and not just 1? A homography is a projective object, in that it has no scale. It is represented by the above matrix, up to scale. One way of fixing the scale is to set one of the coordinates to 1, though that choice is arbitrary. But that’s what most people do and your assignment code does.

Solving for homographies Why the division?

Solving for homographies This is just for one pair of points.

Direct Linear Transforms (n points) 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

Direct Linear Transforms Why could we not solve for the homography in exactly the same way we did for the affine transform, ie.

Answer from Sameer For an affine transform, we have equations of the form Axi + b = yi, solvable by linear regression. For the homography, the equation is of the form Hx̃i ̴ ỹi (homogeneous coordinates) and the ̴ means it holds only up to scale. The affine solution does not hold.

What do we do about the “bad” matches? 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 (from inliers) Find “average” translation vector

RANSAC for estimating homography RANSAC loop: Select four feature pairs (at random) Compute homography H (exact) Compute inliers where ||pi´, H pi|| < ε Keep largest set of inliers Re-compute least-squares H estimate using all of the inliers

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

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

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

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

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

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

Where are we? 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