Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Image Stitching Richard SzeliskiImage Stitching2 1.Align the images over each other – camera pan ↔ translation on cylinder 2.Blend the images together."— Presentation transcript:

1

2 Image Stitching

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

4 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

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

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

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

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

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

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

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

12 Full-view (360° spherical) panoramas

13 Richard SzeliskiImage Stitching12 Full-view Panorama + + + +

14 Richard SzeliskiImage Stitching13 Texture Mapped Model

15 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

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

17 Bundle Adjustment N features, appears in M images

18 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

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

20 Bundle Adjustment Sparse matrix techniques Levenberg-Marquardt http://www.ics.forth.gr/~lourakis/sba/

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

22 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

23 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

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

25 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

26 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

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

28 Recognizing Panoramas Matthew Brown & David Lowe ICCV’2003

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

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

31 Richard SzeliskiImage Stitching30 Finding the panoramas

32 Richard SzeliskiImage Stitching31 Finding the panoramas

33 Richard SzeliskiImage Stitching32 Get you own free copy http://get.live.com/photogallery/overview

34 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]

35 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

36 Richard SzeliskiImage Stitching35 Feature irregularities Distribute points evenly over the image

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

38 Richard SzeliskiImage Stitching37 Probabilistic Feature Matching

39 Richard SzeliskiImage Stitching38 RANSAC motion model

40 Richard SzeliskiImage Stitching39 RANSAC motion model

41 Richard SzeliskiImage Stitching40 RANSAC motion model

42 Richard SzeliskiImage Stitching41 Probabilistic model for verification

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

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

45 Richard SzeliskiImage Stitching44 Matching Mistakes: False Positive

46 Richard SzeliskiImage Stitching45 Matching Mistakes: False Positive

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

48 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?

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

50 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

51 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…

52 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

53 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

54 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

55 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

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

57 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?

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

59 Richard SzeliskiImage Stitching58 Image Feathering

60 Richard SzeliskiImage Stitching59 Feathering 0 1 0 1 + =

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

62 Richard SzeliskiImage Stitching61 Effect of window size 0 1 0 1

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

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

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

66 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

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

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

69 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.

70 ROD Seam Selection Weighted ROD vertex cover with feathering

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

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

73 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

74 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

75 Image Blending

76 Laplacian Pyramid Result in perfect reconstruction when Q is the identity

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

78 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, 217-236.A multiresolution spline with applications to image mosaics

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

80 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

81 Pyramid Blending Figure 9.17 h: pyramid blending

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

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

84 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

85 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


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

Similar presentations


Ads by Google