Lecture 6: Image transformations and alignment CS6670: Computer Vision Noah Snavely.

Slides:



Advertisements
Similar presentations
CS 691 Computational Photography Instructor: Gianfranco Doretto Image Warping.
Advertisements

More Mosaic Madness : Computational Photography Alexei Efros, CMU, Fall 2011 © Jeffrey Martin (jeffrey-martin.com) with a lot of slides stolen from.
Mosaics con’t CSE 455, Winter 2010 February 10, 2010.
Lecture 11: Transformations CS4670/5760: Computer Vision Kavita Bala.
CS4670: Computer Vision Kavita Bala Lecture 10: Feature Matching and Transforms.
Image Warping : Computational Photography Alexei Efros, CMU, Fall 2006 Some slides from Steve Seitz
Announcements Project 2 Out today Sign up for a panorama kit ASAP! –best slots (weekend) go quickly...
Announcements Project 1 artifact voting ( announce later today) Project 2 out today (help session at end of class) IMPORTANT: choose Proj 2 partner.
Announcements. Projection Today’s Readings Nalwa 2.1.
Lecture 8: Geometric transformations CS4670: Computer Vision Noah Snavely.
Image Warping : Computational Photography Alexei Efros, CMU, Fall 2008 Some slides from Steve Seitz
Image Warping : Computational Photography Alexei Efros, CMU, Fall 2005 Some slides from Steve Seitz
Homographies and Mosaics : Computational Photography Alexei Efros, CMU, Fall 2005 © Jeffrey Martin (jeffrey-martin.com) with a lot of slides stolen.
Lecture 5: Projection CS6670: Computer Vision Noah Snavely.
Lecture 7: Image Alignment and Panoramas CS6670: Computer Vision Noah Snavely What’s inside your fridge?
Announcements Mailing list Project 1 test the turnin procedure *this week* (make sure it works) vote on best artifacts in next week’s class Project 2 groups.
Lecture 9: Image alignment CS4670: Computer Vision Noah Snavely
Lecture 13: Projection, Part 2
Announcements Project 2 out today panorama signup help session at end of class Today mosaic recap blending.
Announcements Project 1 artifact voting Project 2 out today panorama signup help session at end of class Guest lectures next week: Li Zhang, Jiwon Kim.
1Jana Kosecka, CS 223b Cylindrical panoramas Cylindrical panoramas with some slides from R. Szeliski, S. Seitz, D. Lowe, A. Efros,
Lecture 6: Image Warping and Projection CS6670: Computer Vision Noah Snavely.
More Mosaic Madness : Computational Photography Alexei Efros, CMU, Fall 2005 © Jeffrey Martin (jeffrey-martin.com) with a lot of slides stolen from.
Panoramas and Calibration : Rendering and Image Processing Alexei Efros …with a lot of slides stolen from Steve Seitz and Rick Szeliski.
Image Warping and Mosacing : Rendering and Image Processing Alexei Efros …with a lot of slides stolen from Steve Seitz and Rick Szeliski.
Announcements Project 1 Grading session this afternoon Artifacts due Friday (voting TBA) Project 2 out (online) Signup for panorama kits ASAP (weekend.
More Mosaic Madness : Computational Photography Alexei Efros, CMU, Fall 2006 © Jeffrey Martin (jeffrey-martin.com) with a lot of slides stolen from.
CS4670 / 5670: Computer Vision KavitaBala Lecture 15: Projection “The School of Athens,” Raphael.
Announcements Project 1 artifact voting Project 2 out today (help session at end of class)
Image warping/morphing Digital Video Special Effects Fall /10/17 with slides by Y.Y. Chuang,Richard Szeliski, Steve Seitz and Alexei Efros.
Image Warping Computational Photography Derek Hoiem, University of Illinois 09/27/11 Many slides from Alyosha Efros + Steve Seitz Photo by Sean Carroll.
Announcements Midterm due Friday, beginning of lecture Guest lecture on Friday: Antonio Criminisi, Microsoft Research.
Mosaics CSE 455, Winter 2010 February 8, 2010 Neel Joshi, CSE 455, Winter Announcements  The Midterm went out Friday  See to the class.
Image Stitching Ali Farhadi CSE 455
Lecture 14: Projection CS4670 / 5670: Computer Vision Noah Snavely “The School of Athens,” Raphael.
Image Warping (Szeliski 3.6.1) cs129: Computational Photography James Hays, Brown, Fall 2012 Slides from Alexei Efros and Steve Seitz
Warping CSE 590 Computational Photography Tamara Berg.
Image Warping Computational Photography Derek Hoiem, University of Illinois 09/23/10 Many slides from Alyosha Efros + Steve Seitz Photo by Sean Carroll.
Mosaics Today’s Readings Szeliski, Ch 5.1, 8.1 StreetView.
Advanced Multimedia Warping & Morphing Tamara Berg.
Mosaics part 3 CSE 455, Winter 2010 February 12, 2010.
Image Warping Many slides from Alyosha Efros + Steve Seitz + Derek oeim Photo by Sean Carroll.
Example: warping triangles Given two triangles: ABC and A’B’C’ in 2D (12 numbers) Need to find transform T to transfer all pixels from one to the other.
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.
CS559: Computer Graphics Lecture 7: Image Warping and Morphing Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
Lecture 14: Projection CS4670 / 5670: Computer Vision Noah Snavely “The School of Athens,” Raphael.
Lecture 14: Feature matching and Transforms CS4670/5670: Computer Vision Kavita Bala.
Lecture 18: Cameras CS4670 / 5670: Computer Vision KavitaBala Source: S. Lazebnik.
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
Image warping/morphing Digital Visual Effects, Spring 2006 Yung-Yu Chuang 2005/3/15 with slides by Richard Szeliski, Steve Seitz and Alexei Efros.
Computer vision: models, learning and inference
Prof. Adriana Kovashka University of Pittsburgh October 3, 2016
CS4670 / 5670: Computer Vision Kavita Bala Lecture 20: Panoramas.
CS5670: Computer Vision Lecture 9: Cameras Noah Snavely
COSC579: Image Align, Mosaic, Stitch
Lecture 7: Image alignment
Image Stitching Slides from Rick Szeliski, Steve Seitz, Derek Hoiem, Ira Kemelmacher, Ali Farhadi.
Recap from Friday Image Completion Synthesis Order Graph Cut Scene Completion.
Idea: projecting images onto a common plane
Announcements Project 2 out today (help session at end of class)
More Mosaic Madness : Computational Photography
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
Image Stitching Linda Shapiro ECE/CSE 576.
Image Stitching Linda Shapiro ECE P 596.
Presentation transcript:

Lecture 6: Image transformations and alignment CS6670: Computer Vision Noah Snavely

Announcement New TA! Adarsh Kowdle Office hours: M 11-12, Ward Laboratory 112

Announcements Project 1 out, due Thursday, 9/24, by 11:59pm Quiz on Thursday, first 10 minutes of class Next week: guest lecturer, Prof. Pedro Felzenszwalb, U. Chicago

Announcements Project 2 will be released on Tuesday You can work in groups of two – Send me your groups by Friday evening

Readings Szeliski Chapter 3.5 (image warping), 9.1 (motion models)

Announcements A total of 3 late days will be allowed for projects

Project 1 questions

Last time: projection

Perspective projection Projection is a matrix multiply using homogeneous coordinates: divide by third coordinate Equivalent to:

Perspective projection (intrinsics) in general, : aspect ratio (1 unless pixels are not square) : skew (0 unless pixels are shaped like rhombi/parallelograms) : principal point ((0,0) unless optical axis doesn’t intersect projection plane at origin) (upper triangular matrix) (converts from 3D rays in camera coordinate system to pixel coordinates)

Extrinsics How do we get the camera to “canonical form”? – (Center of projection at the origin, x-axis points right, y-axis points up, z-axis points backwards) 0 Step 1: Translate by -c

Extrinsics How do we get the camera to “canonical form”? – (Center of projection at the origin, x-axis points right, y-axis points up, z-axis points backwards) 0 Step 1: Translate by -c How do we represent translation as a matrix multiplication?

Extrinsics How do we get the camera to “canonical form”? – (Center of projection at the origin, x-axis points right, y-axis points up, z-axis points backwards) 0 Step 1: Translate by -c Step 2: Rotate by R 3x3 rotation matrix

Extrinsics How do we get the camera to “canonical form”? – (Center of projection at the origin, x-axis points right, y-axis points up, z-axis points backwards) 0 Step 1: Translate by -c Step 2: Rotate by R

Projection matrix (t in book’s notation) translationrotationprojection intrinsics

Projection matrix (t in book’s notation) or

Projection matrix 0 = (in homogeneous image coordinates)

Perspective distortion What does a sphere project to? Image source: F. Durand

Perspective distortion What does a sphere project to?

Distortion Radial distortion of the image – Caused by imperfect lenses – Deviations are most noticeable for rays that pass through the edge of the lens No distortionPin cushionBarrel

Correcting radial distortion from Helmut DerschHelmut Dersch

Modeling distortion To model lens distortion – Use above projection operation instead of standard projection matrix multiplication Apply radial distortion Apply focal length translate image center Project to “normalized” image coordinates

Other types of projection Lots of intriguing variants… (I’ll just mention a few fun ones)

360 degree field of view… Basic approach – Take a photo of a parabolic mirror with an orthographic lens (Nayar) – Or buy one a lens from a variety of omnicam manufacturers… See

Rollout Photographs © Justin Kerr Rotating sensor (or object) Also known as “cyclographs”, “peripheral images”

Photofinish

Questions?

Today: Image transformations and alignment Full screen panoramas (cubic): Mars: New Years Eve:

Why Mosaic? Are you getting the whole picture? – Compact Camera FOV = 50 x 35° Slide from Brown & Lowe

Why Mosaic? Are you getting the whole picture? – Compact Camera FOV = 50 x 35° – Human FOV = 200 x 135° Slide from Brown & Lowe

Why Mosaic? Are you getting the whole picture? – Compact Camera FOV = 50 x 35° – Human FOV = 200 x 135° – Panoramic Mosaic = 360 x 180° Slide from Brown & Lowe

Mosaics: stitching images together

Readings Szeliski: – Chapter 3.5: Image warping – Chapter 5.1: Feature-based alignment – Chapter 8.1: Motion models

Richard SzeliskiImage Stitching34 Image Warping image filtering: change range of image g(x) = h(f(x)) image warping: change domain of image g(x) = f(h(x)) f x h g x f x h g x

Richard SzeliskiImage Stitching35 Image Warping image filtering: change range of image g(x) = h(f(x)) image warping: change domain of image g(x) = f(h(x)) hh f f g g

Richard SzeliskiImage Stitching36 Parametric (global) warping Examples of parametric warps: translation rotation aspect affine perspective cylindrical

Parametric (global) warping Transformation T is a coordinate-changing machine: p’ = T(p) What does it mean that T is global? – Is the same for any point p – can be described by just a few numbers (parameters) Let’s consider linear xforms (can be represented by a 2D matrix): T p = (x,y)p’ = (x’,y’)

Common linear transformations Uniform scaling by s: (0,0) What is the inverse?

Common linear transformations Rotation by angle θ (about the origin) (0,0) What is the inverse? For rotations:

2x2 Matrices What types of transformations can be represented with a 2x2 matrix? 2D mirror about Y axis? 2D mirror over (0,0)?

What types of transformations can be represented with a 2x2 matrix? 2D Translation? Translation is not a linear operation on 2D coordinates NO! 2x2 Matrices

All 2D Linear Transformations Linear transformations are combinations of … – Scale, – Rotation, – Shear, and – Mirror Properties of linear transformations: – Origin maps to origin – Lines map to lines – Parallel lines remain parallel – Ratios are preserved – Closed under composition

Translation Solution: homogeneous coordinates to the rescue

Affine transformations any transformation with last row [ ] we call an affine transformation

Basic affine transformations Translate 2D in-plane rotationShear Scale intrinsics matrix

Affine Transformations Affine transformations are combinations of … – Linear transformations, and – Translations Properties of affine transformations: – Origin does not necessarily map to origin – Lines map to lines – Parallel lines remain parallel – Ratios are preserved – Closed under composition

Projective Transformations Projective transformations … – Affine transformations, and – Projective warps Properties of projective transformations: – Origin does not necessarily map to origin – Lines map to lines – Parallel lines do not necessarily remain parallel – Ratios are not preserved – Closed under composition

Projective Transformations Called a homography (or planar perspective map)

Image warping with homographies image plane in frontimage plane below black area where no pixel maps to

Image rectification To unwarp (rectify) an image Find the homography H given a set of p and p’ pairs How many correspondences are needed? p p’

2D image transformations These transformations are a nested set of groups Closed under composition and inverse is a member

Image Warping Given a coordinate xform (x’,y’) = T(x,y) and a source image f(x,y), how do we compute an xformed image g(x’,y’) = f(T(x,y))? f(x,y)g(x’,y’) xx’ T(x,y) y y’

Forward Warping Send each pixel f(x) to its corresponding location (x’,y’) = T(x,y) in g(x’,y’) f(x,y)g(x’,y’) xx’ T(x,y) What if pixel lands “between” two pixels? y y’

Forward Warping Send each pixel f(x,y) to its corresponding location x’ = h(x,y) in g(x’,y’) f(x,y)g(x’,y’) xx’ T(x,y) What if pixel lands “between” two pixels? Answer: add “contribution” to several pixels, normalize later (splatting) Can still result in holes y y’

Inverse Warping Get each pixel g(x’,y’) from its corresponding location (x,y) = T -1 (x,y) in f(x,y) f(x,y)g(x’,y’) xx’ T -1 (x,y) Requires taking the inverse of the transform What if pixel comes from “between” two pixels? y y’

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 (prefiltered) source image f(x,y)g(x’,y’) xx’ y y’ T -1 (x,y)

Interpolation Possible interpolation filters: – nearest neighbor – bilinear – bicubic (interpolating) – sinc Needed to prevent “jaggies” and “texture crawl” (with prefiltering)

Questions? 3-minute break

Back to mosaics How to we align the images?

Creating a panorama 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 – Transform the second image to overlap with the first – Blend the two together to create a mosaic – If there are more images, repeat

Geometric Interpretation of Mosaics If we capture all 360º of rays, we can create a 360º panorama The basic operation is projecting an image from one plane to another The projective transformation is scene-INDEPENDENT This depends on all the images having the same optical center Image 1 Image 2 Optical Center

Image reprojection Basic question – How to relate two images from the same camera center? how to map a pixel from PP1 to PP2 PP2 PP1 Answer Cast a ray through each pixel in PP1 Draw the pixel where that ray intersects PP2

What is the transformation? Translations are not enough to align the images left on topright on top

What is the transformation? Image 1 Image 2 Optical Center 3x3 homography How do we map image 2 onto image 1’s projection plane? image 1image 2

Can we use homography to create a 360 panorama?

Panoramas What if you want a 360  field of view? mosaic Projection Sphere

– Map 3D point (X,Y,Z) onto sphere Spherical projection X Y Z unit sphere unwrapped sphere Convert to spherical coordinates Spherical image Convert to spherical image coordinates –s defines size of the final image »often convenient to set s = camera focal length

f = 200 (pixels) Spherical reprojection Map image to spherical coordinates – need to know the focal length inputf = 800f = 400

Aligning spherical images Suppose we rotate the camera by  about the vertical axis – How does this change the spherical image?

Aligning spherical images Suppose we rotate the camera by  about the vertical axis – How does this change the spherical image? – Translation by  – This means that we can align spherical images by translation

Questions?