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

Similar documents
Mosaics. Today s Readings

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

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

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

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

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

Announcements. Mosaics. How to do it? Image Mosaics

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

CS6670: Computer Vision

CSE 527: Introduction to Computer Vision

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

EE795: Computer Vision and Intelligent Systems

Feature Matching and RANSAC

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

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

Homographies and RANSAC

Automatic Image Alignment

Automatic Image Alignment

Stitching and Blending

Automatic Image Alignment (feature-based)

N-Views (1) Homographies and Projection

360 Full View Spherical Mosaic

CSE 252B: Computer Vision II

Object Recognition with Invariant Features

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

Image Warping and Mosacing

Midterm Examination CS 534: Computational Photography

Panoramic Image Stitching

Chapter 3 Image Registration. Chapter 3 Image Registration

Image warping and stitching

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

Feature Based Registration - Image Alignment

Image warping and stitching

Local Feature Detectors

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

CS664 Lecture #19: Layers, RANSAC, panoramas, epipolar geometry

Image warping and stitching

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

Fast Image Stitching and Editing for Panorama Painting on Mobile Phones

EE795: Computer Vision and Intelligent Systems

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

Fast Image Stitching and Editing for Panorama Painting on Mobile Phones

CS4670: Computer Vision

An Algorithm for Seamless Image Stitching and Its Application

Video Mosaics for Virtual Environments, R. Szeliski. Review by: Christopher Rasmussen

Image Based Rendering. D.A. Forsyth, with slides from John Hart

CS4670: Computer Vision

CS4670: Computer Vision

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

2D Image Transforms Computer Vision (Kris Kitani) Carnegie Mellon University

Image matching. Announcements. Harder case. Even harder case. Project 1 Out today Help session at the end of class. by Diva Sian.

Image correspondences and structure from motion

EE795: Computer Vision and Intelligent Systems

Local features and image matching. Prof. Xin Yang HUST

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

Agenda. Rotations. Camera calibration. Homography. Ransac

Perspective Projection [2 pts]

The SIFT (Scale Invariant Feature

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

Mobile Panoramic Imaging System

Today s lecture. Structure from Motion. Today s lecture. Parameterizing rotations

Camera Calibration. COS 429 Princeton University

Image warping , , Computational Photography Fall 2017, Lecture 10

Compositing a bird's eye view mosaic

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

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

DD2423 Image Analysis and Computer Vision IMAGE FORMATION. Computational Vision and Active Perception School of Computer Science and Communication

Computer Vision I - Appearance-based Matching and Projective Geometry

Agenda. Rotations. Camera models. Camera calibration. Homographies

Introduction to Image Processing and Computer Vision. -- Panoramas and Blending --

Camera Calibration. Schedule. Jesus J Caban. Note: You have until next Monday to let me know. ! Today:! Camera calibration

Camera Model and Calibration

Today. Stereo (two view) reconstruction. Multiview geometry. Today. Multiview geometry. Computational Photography

Cameras and Radiometry. Last lecture in a nutshell. Conversion Euclidean -> Homogenous -> Euclidean. Affine Camera Model. Simplified Camera Models

Prof. Feng Liu. Spring /26/2017

Local Features: Detection, Description & Matching

CS6670: Computer Vision

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

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

Panoramic Image Mosaicing

COSC579: Scene Geometry. Jeremy Bolton, PhD Assistant Teaching Professor

Image Stitching using Harris Feature Detection

Visual Recognition: Image Formation

DD2429 Computational Photography :00-19:00

Feature Detectors and Descriptors: Corners, Lines, etc.

Image Mosaicing using MATLAB

CS 4495 Computer Vision A. Bobick. CS 4495 Computer Vision. Features 2 SIFT descriptor. Aaron Bobick School of Interactive Computing

Image Features: Local Descriptors. Sanja Fidler CSC420: Intro to Image Understanding 1/ 58

Photo Tourism: Exploring Photo Collections in 3D

CS4670: Computer Vision

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

Implementation of an Image Stitching Algorithm to a Low-Cost Digital Microscope

calibrated coordinates Linear transformation pixel coordinates

Local features: detection and description. Local invariant features

Visual Odometry. Features, Tracking, Essential Matrix, and RANSAC. Stephan Weiss Computer Vision Group NASA-JPL / CalTech

Feature Matching and Robust Fitting

Computer Vision. Coordinates. Prof. Flávio Cardeal DECOM / CEFET- MG.

Global Flow Estimation. Lecture 9

Feature-Based Image Mosaicing

Transcription:

Today s lecture Image Alignment and Stitching Computer Vision CSE576, Spring 2005 Richard Szeliski Image alignment and stitching motion models cylindrical and spherical warping point-based alignment global alignment automated stitching (recognizing panoramas) ghost and parallax removal compositing and blending Richard Szeliski CSE 576 (Spring 2005): Computer Vision 2 Readings Szeliski & Shum, SIGGRAPH'97 (Sections 1-4). Szeliski, Image Alignment and Stitching, MSR-TR-2004-92 (Sections 2, 4, 5). Recognizing Panoramas, Brown & Lowe, ICCV 2003 Motion models Richard Szeliski CSE 576 (Spring 2005): Computer Vision 3

Motion models Motion models What happens when we take two images with a camera and try to align them? translation? rotation? scale? affine? perspective? see interactive demo (VideoMosaic) Richard Szeliski CSE 576 (Spring 2005): Computer Vision 5 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 6 Motion models Homographies Translation Affine Perspective 3D rotation 2 unknowns 6 unknowns 8 unknowns 3 unknowns Richard Szeliski CSE 576 (Spring 2005): Computer Vision 7 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' * * wy' = * * w * * To apply a homography H p H Compute p = Hp (regular matrix multiply) Convert p from homogeneous to image coordinates divide by w (third) coordinate * x * y * 1 p Richard Szeliski CSE 576 (Spring 2005): Computer Vision 8

Plane perspective mosaics Rotational mosaics 8-parameter generalization of affine motion works for pure rotation or planar surfaces Limitations: local minima slow convergence difficult to control interactively Directly optimize rotation and focal length Advantages: ability to build full-view panoramas easier to control interactively more stable and accurate estimates Richard Szeliski CSE 576 (Spring 2005): Computer Vision 9 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 10 3D 2D Perspective Projection 3D Rotation Model f u c u (X c,y c,z c ) Projection equations 1. Project from image to 3D ray (x 0,y 0,z 0 ) = (u 0 -u c,v 0 -v c,f) 2. Rotate the ray by camera motion (x 1,y 1,z 1 ) = R 01 (x 0,y 0,z 0 ) 3. Project back into new (source) image (u 1,v 1 ) = (fx 1 /z 1 +u c,fy 1 /z 1 +v c ) Richard Szeliski CSE 576 (Spring 2005): Computer Vision 11 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 12

Rotations and quaternions How do we represent rotation matrices? Rotations and quaternions How do we represent rotation matrices? 1. Axis / angle (n,θ) R = I + sinθ [n] + (1- cosθ) [n] 2 (Rodriguez Formula), with [n] = cross product matrix (see paper) 2. Unit quaternions [Shoemake SIGGRAPH 85] q = (n sinθ/2, cosθ/2) = (w,s) quaternion multiplication (division is easy) q 0 q 1 = (s 1 w 0 + s 0 w 1, s 0 s 1 -w 0 w 1 ) Richard Szeliski CSE 576 (Spring 2005): Computer Vision 13 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 14 Incremental rotation update 1. Small angle approximation R = I + sinθ [n] + (1- cosθ) [n] 2 θ [n] = [ω] linear in ω 2. Update original R matrix R R R Image Mosaics (Stitching) [Szeliski & Shum, SIGGRAPH 97] [Szeliski, MSR-TR-2004-92] Richard Szeliski CSE 576 (Spring 2005): Computer Vision 15

Image Mosaics (Stitching) Image Mosaics (stitching) Blend together several overlapping images into one seamless mosaic (composite) + + + = Full screen panoramas (cubic): http://www.panoramas.dk/ Mars: http://www.panoramas.dk/fullscreen3/f2_mars97.html 2003 New Years Eve: http://www.panoramas.dk/fullscreen3/f1.html Richard Szeliski CSE 576 (Spring 2005): Computer Vision 17 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 18 Mosaics for Video Coding Convert masked images into a background sprite for content-based coding = + + + Establishing correspondences 1. Direct method: Use generalization of affine motion model [Szeliski & Shum 97] 2. Feature-based method Compute feature-based correspondence [Lowe ICCV 99; Schmid ICCV 98, Brown&Lowe ICCV 2003] Compute R from correspondences (absolute orientation) Richard Szeliski CSE 576 (Spring 2005): Computer Vision 19 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 20

Stitching demo Panoramas What if you want a 360 field of view? mosaic Projection Cylinder Richard Szeliski CSE 576 (Spring 2005): Computer Vision 21 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 22 Cylindrical panoramas Cylindrical Panoramas Map image to cylindrical or spherical coordinates need known focal length Steps Reproject each image onto a cylinder Blend Output the resulting mosaic Image 384x300 f = 180 (pixels) f = 280 f = 380 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 23 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 24

Cylindrical projection Map 3D point (X,Y,Z) onto cylinder Cylindrical warping Given focal length f and image center (x c,y c ) Y Z X unit cylinder Convert to cylindrical coordinates Convert to cylindrical image coordinates s defines size of the final image Y (X,Y,Z) (sinθ,h,cosθ) Z X unwrapped cylinder cylindrical image Richard Szeliski CSE 576 (Spring 2005): Computer Vision 25 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 26 Spherical warping Given focal length f and image center (x c,y c ) 3D rotation Rotate image before placing on unrolled sphere (x,y,z) φ cos φ (x,y,z) φ cos φ Y (sinθcosφ,cosθcosφ,sinφ) Z X sin φ cos θ cos φ Y (sinθcosφ,cosθcosφ,sinφ) Z X p = R p sin φ cos θ cos φ Richard Szeliski CSE 576 (Spring 2005): Computer Vision 27 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 28

Radial distortion Correct for bending in wide field of view lenses Fisheye lens Extreme bending in ultra-wide fields of view Richard Szeliski CSE 576 (Spring 2005): Computer Vision 29 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 30 Inverse Warping Get each pixel I 0 (u 0 ) from its corresponding location u 1 = h(u 0 ) in I 1 (u 1 ) What if pixel comes from between two pixels? Answer in next lecture Image Stitching 1. Align the images over each other camera pan translation on cylinder! 2. Blend the images together (demo) h(u 0 ) x 1 x I 1 (u 1 ) 0 I 0 (u 0 ) Richard Szeliski CSE 576 (Spring 2005): Computer Vision 31 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 32

Project 2 image stitching 1. Take pictures on a tripod (or handheld) 2. Warp images 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 Matching features What do we do about the bad matches? Richard Szeliski CSE 576 (Spring 2005): Computer Vision 33 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 34 RAndom SAmple Consensus RAndom SAmple Consensus Select one match, count inliers Select one match, count inliers Richard Szeliski CSE 576 (Spring 2005): Computer Vision 35 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 36

Least squares fit Assembling the panorama Stitch pairs together, blend, then crop Find average translation vector Richard Szeliski CSE 576 (Spring 2005): Computer Vision 37 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 38 Problem: Drift Full-view (360 spherical) panoramas Error accumulation small (vertical) errors accumulate over time apply correction so that sum = 0 (for 360 pan.) Richard Szeliski CSE 576 (Spring 2005): Computer Vision 39

Full-view Panoramas Global alignment + + = + + Register all pairwise overlapping images Use a 3D rotation model (one R per image) Use feature based registration of unwarped images Discover which images overlap other images using feature selection (RANSAC) Chain together inter-frame rotations Optimize all R estimates together (next time) Richard Szeliski CSE 576 (Spring 2005): Computer Vision 41 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 42 3D Rotation Model Projection equations 1. Project from image to 3D ray (x 0,y 0,z 0 ) = (u 0 -u c,v 0 -v c,f) 2. Rotate the ray by camera motion (x 1,y 1,z 1 ) = R 01 (x 0,y 0,z 0 ) 3. Project back into new (source) image (u 1,v 1 ) = (fx 1 /z 1 +u c,fy 1 /z 1 +v c ) Absolute orientation [Arun et al., PAMI 1987] [Horn et al., JOSA A 1988] Procrustes Algorithm [Golub & VanLoan] Given two sets of matching points, compute R p i = R p i with 3D rays p i = (x i,y i,z i ) = (u i -u c,v i -v c,f) A = Σ i p i p i T = Σ i p i p it R T = U S V T = (U S U T ) R T V T = U T R T R = VU T Richard Szeliski CSE 576 (Spring 2005): Computer Vision 43 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 44

Stitching demo Texture Mapped Model (sphere) Richard Szeliski CSE 576 (Spring 2005): Computer Vision 45 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 46 Texture Mapped Model (cubical) Recognizing Panoramas Matthew Brown & David Lowe ICCV 2003 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 47

Recognizing Panoramas Finding the panoramas [Brown & Lowe, ICCV 03] Richard Szeliski CSE 576 (Spring 2005): Computer Vision 49 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 50 Finding the panoramas Finding the panoramas Richard Szeliski CSE 576 (Spring 2005): Computer Vision 51 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 52

Finding the panoramas Fully automated 2D stitching Demo Richard Szeliski CSE 576 (Spring 2005): Computer Vision 53 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 54 Get you own copy! System components Feature detection and description more uniform point density Fast matching (hash table) RANSAC filtering of matches Intensity-based verification Incremental bundle adjustment [Brown, Szeliski, Winder, CVPR 05] Richard Szeliski CSE 576 (Spring 2005): Computer Vision 55 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 56

Multi-Scale Oriented Patches Interest points Multi-scale Harris corners Orientation from blurred gradient Geometrically invariant to similarity transforms Descriptor vector Bias/gain normalized sampling of local patch (8x8) Photometrically invariant to affine changes in intensity Feature irregularities Distribute points evenly over the image Richard Szeliski CSE 576 (Spring 2005): Computer Vision 57 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 58 Descriptor Vector Probabilistic Feature Matching Orientation = blurred gradient Similarity Invariant Frame Scale-space position (x, y, s) + orientation (θ) Richard Szeliski CSE 576 (Spring 2005): Computer Vision 59 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 60

RANSAC motion model RANSAC motion model Richard Szeliski CSE 576 (Spring 2005): Computer Vision 61 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 62 RANSAC motion model Probabilistic model for verification Richard Szeliski CSE 576 (Spring 2005): Computer Vision 63 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 64

How well does this work? How well does this work? Test on 100s of examples Test on 100s of examples still too many failures (5-10%) for consumer application Matching Mistakes: False Positive Matching Mistakes: False Positive Richard Szeliski CSE 576 (Spring 2005): Computer Vision 67 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 68

Matching Mistakes: False Negative Moving objects: large areas of disagreement Matching Mistakes Accidental alignment repeated / similar regions Failed alignments moving objects / parallax low overlap feature-less regions (more variety?) No 100% reliable algorithm? Richard Szeliski CSE 576 (Spring 2005): Computer Vision 69 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 70 How can we fix these? Tune the feature detector Tune the feature matcher (cost metric) Tune the RANSAC stage (motion model) Tune the verification stage Use higher-level knowledge e.g., typical camera motions Deghosting and blending (optional material) Sounds like a big learning problem Need a large training/test data set (panoramas) Richard Szeliski CSE 576 (Spring 2005): Computer Vision 71

Local alignment (deghosting) Use local optic flow to compensate for small motions [Shum & Szeliski, ICCV 98] Local alignment (deghosting) Use local optic flow to compensate for radial distortion [Shum & Szeliski, ICCV 98] Richard Szeliski CSE 576 (Spring 2005): Computer Vision 73 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 74 Image feathering Weight each image proportional to its distance from the edge (distance map [Danielsson, CVGIP 1980] Region-based de-ghosting Select only one image in regions-of-difference using weighted vertex cover [Uyttendaele et al., CVPR 01] Cut out the appropriate region from each image and then blend together Richard Szeliski CSE 576 (Spring 2005): Computer Vision 75 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 76

Region-based de-ghosting Select only one image in regions-of-difference using weighted vertex cover [Uyttendaele et al., CVPR 01] Cutout-based de-ghosting Select only one image per output pixel, using spatial continuity Blend across seams using gradient continuity ( Poisson blending ) [Agarwala et al., SG 2004] Richard Szeliski CSE 576 (Spring 2005): Computer Vision 77 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 78 Cutout-based compositing Photomontage [Agarwala et al., SG 2004] Interactively blend different images: group portraits Cutout-based compositing Photomontage [Agarwala et al., SG 2004] Interactively blend different images: focus settings Richard Szeliski CSE 576 (Spring 2005): Computer Vision 79 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 80

Cutout-based compositing Photomontage [Agarwala et al., SG 2004] Interactively blend different images: people s faces Final thought: What is a panorama? Tracking a subject Repeated (best) shots Multiple exposures Infer what photographer wants? Richard Szeliski CSE 576 (Spring 2005): Computer Vision 81 Richard Szeliski CSE 576 (Spring 2005): Computer Vision 82