Image Stitching Richard SzeliskiImage Stitching2 1.Align the images over each other – camera pan ↔ translation on cylinder 2.Blend the images together.

Slides:



Advertisements
Similar presentations
Summary of Friday A homography transforms one 3d plane to another 3d plane, under perspective projections. Those planes can be camera imaging planes or.
Advertisements

RANSAC and mosaic wrap-up cs129: Computational Photography James Hays, Brown, Fall 2012 © Jeffrey Martin (jeffrey-martin.com) most slides from Steve Seitz,
Multiple View Reconstruction Class 24 Multiple View Geometry Comp Marc Pollefeys.
CSCE 641 Computer Graphics: Image Mosaicing Jinxiang Chai.
Mosaics con’t CSE 455, Winter 2010 February 10, 2010.
Computational Photography: Image Mosaicing Jinxiang Chai.
Lecture 14: Panoramas CS4670: Computer Vision Noah Snavely What’s inside your fridge?
Projective structure from motion
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.
Recognising Panoramas
Direct Methods for Visual Scene Reconstruction Paper by Richard Szeliski & Sing Bing Kang Presented by Kristin Branson November 7, 2002.
Automatic Panoramic Image Stitching using Local Features Matthew Brown and David Lowe, University of British Columbia.
Automatic Image Alignment (feature-based) : Computational Photography Alexei Efros, CMU, Fall 2005 with a lot of slides stolen from Steve Seitz and.
Lecture 11: Structure from motion CS6670: Computer Vision Noah Snavely.
Image Stitching and Panoramas
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.
CSCE 641 Computer Graphics: Image Mosaicing Jinxiang Chai.
Lecture 8: Image Alignment and RANSAC
More Mosaic Madness : Computational Photography Alexei Efros, CMU, Fall 2005 © Jeffrey Martin (jeffrey-martin.com) with a lot of slides stolen from.
Multiple View Reconstruction Class 23 Multiple View Geometry Comp Marc Pollefeys.
Announcements Project 1 Grading session this afternoon Artifacts due Friday (voting TBA) Project 2 out (online) Signup for panorama kits ASAP (weekend.
Automatic Image Alignment (feature-based) : Computational Photography Alexei Efros, CMU, Fall 2006 with a lot of slides stolen from Steve Seitz and.
Image Stitching II Ali Farhadi CSE 455
Optical Flow Digital Photography CSE558, Spring 2003 Richard Szeliski (notes cribbed from P. Anandan)
Announcements Project 1 artifact voting Project 2 out today (help session at end of class)
Lecture 12: Structure from motion CS6670: Computer Vision Noah Snavely.
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.
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
Digital Camera and Computer Vision Laboratory Department of Computer Science and Information Engineering National Taiwan University, Taipei, Taiwan, R.O.C.
Image Stitching Shangliang Jiang Kate Harrison. What is image stitching?
The Brightness Constraint
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.
Example: line fitting. n=2 Model fitting Measure distances.
Image Stitching Ali Farhadi CSE 576 Several slides from Rick Szeliski, Steve Seitz, Derek Hoiem, and Ira Kemelmacher.
CS4670 / 5670: Computer Vision KavitaBala Lecture 17: Panoramas.
Mosaics part 3 CSE 455, Winter 2010 February 12, 2010.
Last Two Lectures Panoramic Image Stitching
776 Computer Vision Jan-Michael Frahm Spring 2012.
Image Stitching II Linda Shapiro CSE 455. RANSAC for Homography Initial Matched Points.
Mosaics Today’s Readings Szeliski and Shum paper (sections 1 and 2, skim the rest) –
Digital Camera and Computer Vision Laboratory Department of Computer Science and Information Engineering National Taiwan University, Taipei, Taiwan, R.O.C.
CSCI 631 – Foundations of Computer Vision March 15, 2016 Ashwini Imran Image Stitching.
Image Stitching Computer Vision CS 691E Some slides from Richard Szeliski.
Hebrew University Image Processing Exercise Class 8 Panoramas – Stitching and Blending Min-Cut Stitching Many slides from Alexei Efros.
Invariant Local Features Image content is transformed into local feature coordinates that are invariant to translation, rotation, scale, and other imaging.
776 Computer Vision Jan-Michael Frahm Spring 2012.
Image Stitching II Linda Shapiro EE/CSE 576.
CS4670 / 5670: Computer Vision Kavita Bala Lecture 20: Panoramas.
COSC579: Image Align, Mosaic, Stitch
RANSAC and mosaic wrap-up
Image Stitching Slides from Rick Szeliski, Steve Seitz, Derek Hoiem, Ira Kemelmacher, Ali Farhadi.
Features Readings All is Vanity, by C. Allan Gilbert,
Idea: projecting images onto a common plane
Announcements Project 2 out today (help session at end of class)
Image Stitching II Linda Shapiro EE/CSE 576.
Image Stitching II Linda Shapiro CSE 455.
Image Stitching Computer Vision CS 678
Noah Snavely.
Announcements Project 1 Project 2 Vote for your favorite artifacts!
Announcements Project 1 artifact voting Project 2 out today
Image Stitching II Linda Shapiro EE/CSE 576.
Computational Photography
Image Stitching Linda Shapiro ECE/CSE 576.
Image Stitching II Linda Shapiro ECE P 596.
Image Stitching Linda Shapiro ECE P 596.
Presentation transcript:

Image Stitching

Richard SzeliskiImage Stitching2 1.Align the images over each other – camera pan ↔ translation on cylinder 2.Blend the images together

Richard SzeliskiImage Stitching3 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

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

Richard SzeliskiImage Stitching5 RAndom SAmple Consensus Select one match, count inliers

Richard SzeliskiImage Stitching6 RAndom SAmple Consensus Select one match, count inliers

Richard SzeliskiImage Stitching7 Least squares fit Find “average” translation vector

Richard SzeliskiImage Stitching8 Assembling the panorama Stitch pairs together, blend, then crop

Richard SzeliskiImage Stitching9 Problem: Drift Error accumulation – small (vertical) errors accumulate over time – apply correction so that sum = 0 (for 360° pan.)

Richard SzeliskiImage Stitching10 Problem: Drift Solution – add another copy of first image at the end – this gives a constraint: y n = y 1 – there are a bunch of ways to solve this problem add displacement of (y 1 – y n )/(n -1) to each image after the first compute a global warp: y’ = y + ax run a big optimization problem, incorporating this constraint – best solution, but more complicated – known as “bundle adjustment” (x 1,y 1 ) copy of first image (x n,y n )

Full-view (360° spherical) panoramas

Richard SzeliskiImage Stitching12 Full-view Panorama

Richard SzeliskiImage Stitching13 Texture Mapped Model

Richard SzeliskiImage Stitching14 Global alignment Pairwise matching  global energy function that involves all of the per-image pose parameters Local adjustments to reduce blurring due to local mis-registration Panorama recogition

Bundle Adjustment Developed in photogrammetry in 50´s, for general structure from motion (Szeliski and Kang 1994) Pairwise alignment

Bundle Adjustment N features, appears in M images

Bundle Adjustment Given initial set of {Rj, Kj}, refine them together Xik depends on xij, error-in-variable Overweighted for feature observed many times Observed location of feature I in image k Predicted location of feature I in image k

Bundle Adjustment True bundle adjustment to estimate camera pose and 3d points Disadvantages – A lot of variables to solve – Slow convergence

Bundle Adjustment Sparse matrix techniques Levenberg-Marquardt

20 Non-linear least squares Linear approximation of residual allows quadratic approximation of sum- of-squares N (extra term = descent term) Minimization corresponds to finding zeros of derivative Levenberg-Marquardt: extra term to deal with singular N (decrease/increase if success/failure to descent)

21 Bundle Adjustment U1U1 U2U2 U3U3 WTWT W V P1P1 P2P2 P3P3 M Jacobian of has sparse block structure – cameras independent of other cameras, – points independent of other points 12xm 3xn (in general much larger) im.pts. view 1 Needed for non-linear minimization

22 Bundle Adjustment Eliminate dependence of camera/motion parameters on structure parameters Note in general 3n >> 11m WTWT V U-WV -1 W T 11xm 3xn Allows much more efficient computations e.g. 100 views,10000 points, solve  1000x1000, not  30000x30000 Often still band diagonal use sparse linear algebra algorithms

Up Vector Selection Keep the upright direction at the final stitched image Multiply each roation by a global rotation Rg

Up Vector Selection r g1 is the smallest eigenvector of the scatter or moment matrix spanned by the individual camera rotation x-vectors Full rotation matrix Rg

Parallax Removal Blurry or ghosting – Unmodeled radial distortion – 3D parallax: failure to rotate the camera around its optical center – Small scene motion, large scale scene motion Different approaches for them

Parallax Removal Based on bundle adjustment, compute 3D point location, then reproject it to images Deghosting a mosaic with motion parallax (Shum and Szeliski 2000) c 2000 IEEE: (a) composite with parallax; (b) after a single deghosting step (patch size 32); (c) after multiple steps (sizes 32, 16 and 8)

Recognizing Panoramas Matthew Brown & David Lowe ICCV’2003

Richard SzeliskiImage Stitching28 Recognizing Panoramas [Brown & Lowe, ICCV’03]

Richard SzeliskiImage Stitching29 Finding the panoramas Find all pairwise image overlaps Find connected components in the overlap graph

Richard SzeliskiImage Stitching30 Finding the panoramas

Richard SzeliskiImage Stitching31 Finding the panoramas

Richard SzeliskiImage Stitching32 Get you own free copy

Richard SzeliskiImage Stitching33 Rec.pano.: system components 1.Feature detection and description – more uniform point density 2.Fast matching (hash table) 3.RANSAC filtering of matches 4.Intensity-based verification 5.Incremental bundle adjustment [M. Brown, R. Szeliski, and S. Winder. Multi-image matching using multi-scale oriented patches, CVPR'2005]

Richard SzeliskiImage Stitching34 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

Richard SzeliskiImage Stitching35 Feature irregularities Distribute points evenly over the image

Richard SzeliskiImage Stitching36 Descriptor Vector Orientation = blurred gradient Similarity Invariant Frame – Scale-space position (x, y, s) + orientation (  )

Richard SzeliskiImage Stitching37 Probabilistic Feature Matching

Richard SzeliskiImage Stitching38 RANSAC motion model

Richard SzeliskiImage Stitching39 RANSAC motion model

Richard SzeliskiImage Stitching40 RANSAC motion model

Richard SzeliskiImage Stitching41 Probabilistic model for verification

How well does this work? Test on 100s of examples…

How well does this work? Test on 100s of examples… …still too many failures (5-10%) for consumer application

Richard SzeliskiImage Stitching44 Matching Mistakes: False Positive

Richard SzeliskiImage Stitching45 Matching Mistakes: False Positive

Richard SzeliskiImage Stitching46 Matching Mistake: False Negative Moving objects: large areas of disagreement

Richard SzeliskiImage Stitching47 Matching Mistakes Accidental alignment – repeated / similar regions Failed alignments – moving objects / parallax – low overlap – “feature-less” regions (more variety?) No 100% reliable algorithm?

Richard SzeliskiImage Stitching48 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 → Sounds like a b ig “learning” problem – Need a large training/test data set (panoramas)

Direct vs. Feature-based Alignment Feature-based – Confused in too textural or not textured enough region – Features should be distributed evenly over the image – Relies on robust feature detection and matching schemes Direct – Limited range of convergence, even hierarchical framework – Work for video, fail for partially overlapping images

Image Compositing How to produce the final mosaic image? – Compositing surface (flat, cylindrical, spherical, etc) – View (reference image) – Select and blend pixels to minimize visible seams, blur, and ghosting Surface parameterization, pixel and seam selection, blending, exposure compensation…

Compositing Surface If only a few images --- flat panorama – select one image as reference and warp all the others to the reference coordinate system – Still perspective projection

Compositing Surface Large field of view – Large distortion – Usually use a cylindrical or spherical projection – Environment map Tradeoff between – keeping local appearance undistorted, and – providing a reasonably uniform sampling of the environment mosaic plane

View Selection Which part of the scene will be centered in the final composition – Average depth – Middle image in a 360 panorama – Image that contains the object of greatest interest – User control

Coordinate Transformations Mapping between input and output pixels – Flat surface: homography – Analytic form (cylindrical, spherical…) Pixel in panorama -> 3D view ray -> image Precompute lookup tables X Y Z cylindrical image

Sampling Issues Low-resolution panorama than input images – Prefilter input images to avoid aliasing

Pixel Selection and Weighting (De-ghosting) Without perfect registration and identically exposed – Visible seams dues to exposure difference – Blurring due to mis-registration – Ghosting due to moving objects Which pixels to user? How to blend them?

Richard SzeliskiImage Stitching57 Image feathering Weight each image proportional to its distance from the edge (distance map [Danielsson, CVGIP 1980] 1. Generate weight map for each image 2. Sum up all of the weights and divide by sum: weights sum up to 1: w i ’ = w i / ( ∑ i w i )

Richard SzeliskiImage Stitching58 Image Feathering

Richard SzeliskiImage Stitching59 Feathering =

Richard SzeliskiImage Stitching60 Effect of window size 0 1 left right 0 1

Richard SzeliskiImage Stitching61 Effect of window size

Richard SzeliskiImage Stitching62 Good window size 0 1 “Optimal” window: smooth but not ghosted Doesn’t always work...

Feathering and Center-Weighting Warped images W_k: simple 0 or 1 Simple averaging: exposure difference, misregistration and scene movement are all visible If rapidly moving objects are the only problem, taking median filter to remove them (Irani and Anandan 1998)

Feathering and Center-Weighting Weight on distance to image center Feathering: weighted averaging with a distance map Bluring, ghosting still exist Feathered average

Feathering and Center-Weighting Improve feathering – Raise distance map value with larger power Tradeoff between visible exposure difference and blur –, Select pixel with largest weight

Feathering and Center-Weighting Have hard edges when exposure vary P=10 p=∞

Feathering and Center-Weighting Seam placement: optimal seam selection Moving object produce most visible artifacts: ghost – Region of difference where overlapping image disagree – Construct a graph – Weighted vertex cover: find the smallest set of vertexes without disagreement Uyttendaele, Eden, and Szeliski (2001)

Seam Selection Computation of regions of difference (RODs) (Uyttendaele, Eden, and Szeliski 2001) c 2001 IEEE: (a) three overlapping images with a moving face; (b) corresponding RODs; (c) graph of coincident RODs.

ROD Seam Selection Weighted ROD vertex cover with feathering

Photomontage First, Per-pixel image objective to good composites Data penaltyChosing image l at pixel x Agarwala, Dontcheva, Agrawala et al. 2004

Photomontage Second, seam objective that penalizes differences in labeling between adjacent images Optimization: Markov Random Field (MRF) Poisson image blending Seam penalty

Seam Selection Graph cuts and Vertex cover both produce similar looking results – Graph cuts are slower because of optimization over all pixels – Vertex cover is sensitive to thresholds used to determine regions of difference

Blending Compensate for exposure difference and other mis-alignments Using weighted blending, hard to get balance between smoothing out exposure variations and preventing blurring Laplacian pyramid blending Gradient domain blending Exposure compensation

Image Blending

Laplacian Pyramid Result in perfect reconstruction when Q is the identity

Laplacian Pyramid Actual computation of high-pass filter Low-pass images: Gaussian images High-pass (or band-pass) images: Laplacian Images

Richard SzeliskiImage Stitching77 Pyramid Blending Burt, P. J. and Adelson, E. H., A multiresolution spline with applications to image mosaics, ACM Transactions on Graphics, 42(4), October 1983, A multiresolution spline with applications to image mosaics

Richard SzeliskiImage Stitching78 Laplacian level 4 Laplacian level 2 Laplacian level 0 left pyramidright pyramidblended pyramid

Richard SzeliskiImage Stitching79 Laplacian Image Blend 1.Compute Laplacian pyramid 2.Compute Gaussian pyramid on weight image (can put this in A channel) 3.Blend Laplacians using Gaussian blurred weights 4.Reconstruct the final image

Pyramid Blending Figure 9.17 h: pyramid blending

Gradient Domain Blending Perform blending in gradient domain rather than color domain Poisson image editing (P´erez, Gangnet, and Blake 2003)

Gradient Domain Editing Guided Vector Field: Source image Mixture gradient (source + target image)

Exposure Compensation Estimate local correction between source image and a blended composite Stitch image in the radiance domain – Convert image into radiance image – Create a stitched, high-dynamic range (HDR) image

Richard SzeliskiImage Stitching84 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