本章首先复习了上一讲相关相机的知识，然后介绍相机模型、单应性、解线性方程组的齐次方程组、Keypoint-based对齐、RANSAC、混合、iphone缝合器是如何工作的等相关内容。单应性(单应性)在数学中相当于射影线性变换在视觉(最常用)中:单应性是指两个图像平面之间的线性变换正如投影三维表面到正面视图或是将两个仅因旋转而不同的视图关联起来
- 111
- 0
- 0
注脚
展开查看详情
1.Image Stitching Computer Vision Jia-Bin Huang, Virginia Tech Many slides from S. Seitz and D. Hoiem Add example
2.Administrative stuffs HW 3 is out due 11:59 PM Oct 17 Please start early. D eadlines are firm. N o emails requesting extensions Getting help? *Five* free late days without penalty Piazza Office hours No free late dates for final projects
3.Review: Camera Projection Matrix O w i w k w j w t R 3
4.Review: Camera Calibration Method 1: Use an object (calibration grid) with known geometry Correspond image points to 3d points Get least squares solution (or non-linear solution) 4 Known 3d locations Known 2d image coordinates Unknown Camera Parameters
5.Review: Camera Calibration Method 1: Use an object (calibration grid) with known geometry Correspond image points to 3d points Get least squares solution (or non-linear solution) 4 Known 3d locations Known 2d image coordinates Unknown Camera Parameters
6.Constraints for , Review: Calibration by vanishing points Orthogonality constraints VP (2D) VP (3D) Unknown c amera parameters = 0 = 0 = 0 … Eqn (1) … Eqn (2) … Eqn (3) Eqn (1 ) – Eqn (2) Eqn (2) – Eqn ( 3 ) Solve for
7.Rotation matrix Set directions of vanishing points Review: Calibration by vanishing points Unknown c amera parameters Special properties of R inv ( R )= R T Each row and column of R has unit length
8.Measuring height R H v z r b t H b 0 t 0 v v x v y vanishing line (horizon) image cross ratio Slide by Steve Seitz 8
9.This class: Image Stitching Combine two or more overlapping images to make one larger image Add example Slide credit: Vaibhav Vaish
10.Concepts introduced/reviewed in today’s lecture Camera model Homographies Solving homogeneous systems of linear equations Keypoint -based alignment RANSAC Blending How the iphone stitcher works
11.Illustration Camera Center
12.Problem set-up x = K [R t] X x = K [R t] X t=t=0 x= Hx where H = K R R -1 K -1 Typically only R and f will change (4 parameters), but, in general, H has 8 parameters f f . x x X
13.Homography Definition General mathematics: homography = projective linear transformation Vision (most common usage): homography = linear transformation between two image planes Examples Project 3D surface into frontal view Relate two views that differ only by rotation
14.Homography example: Image rectification To unwarp (rectify) an image solve for homography H given p and p ’ : w p ’=Hp p p’
15.Homography example: Planar mapping Freedom HP Commercial
16.Image Stitching Algorithm Overview Detect keypoints (e.g., SIFT) Match keypoints (e.g., 1 st /2 nd NN < thresh) Estimate homography with four matched keypoints (using RANSAC) Combine images
17.Computing homography Assume we have four matched points: How do we compute homography H ? Direct Linear Transformation (DLT)
18.Computing homography Direct Linear Transform Apply SVD: UDV T = A h = V smallest (column of V corr. to smallest singular value) Matlab [U, S, V] = svd(A); h = V(:, end); Explanations of SVD and solving homogeneous linear systems
19.Computing homography Assume we have four matched points: How do we compute homography H ? Normalized DLT Normalize coordinates for each image Translate for zero mean Scale so that average distance to origin is ~ sqrt (2) This makes problem better behaved numerically (see HZ p. 107-108) Compute using DLT in normalized coordinates Unnormalize :
20.Computing homography Assume we have matched points with outliers: How do we compute homography H ? Automatic Homography Estimation with RANSAC Choose number of samples N HZ Tutorial ‘99
21.Computing homography Assume we have matched points with outliers: How do we compute homography H ? Automatic Homography Estimation with RANSAC Choose number of samples N Choose 4 random potential matches Compute H using normalized DLT Project points from x to x ’ for each potentially matching pair: Count points with projected distance < t E.g., t = 3 pixels Repeat steps 2-5 N times Choose H with most inliers HZ Tutorial ‘99
22.Automatic Image Stitching Compute interest points on each image Find candidate matches Estimate homography H using matched points and RANSAC with normalized DLT Project each image onto the same surface and blend Matlab : maketform , imtransform
23.RANSAC for Homography Initial Matched Points
24.RANSAC for Homography Final Matched Points
25.Verification
26.RANSAC for Homography
27.Choosing a Projection Surface Many to choose: planar, cylindrical, spherical, cubic, etc.
28.Planar Mapping f f x x For red image: pixels are already on the planar surface For green image: map to first image plane
29.Planar Projection Planar Photos by Russ Hewett
30.Planar Projection Planar
31.Cylindrical Mapping f f x x For red image: compute h, theta on cylindrical surface from (u, v) For green image: map to first image plane, than map to cylindrical surface
32.Cylindrical Projection Cylindrical
33.Cylindrical Projection Cylindrical
34.Planar Cylindrical
35.Recognizing Panoramas Brown and Lowe 2003, 2007 Some of following material from Brown and Lowe 2003 talk
36.Recognizing Panoramas Input: N images Extract SIFT points, descriptors from all images Find K-nearest neighbors for each point (K=4) For each image Select M candidate matching images by counting matched keypoints (m=6) Solve homography H ij for each matched image
37.Recognizing Panoramas Input: N images Extract SIFT points, descriptors from all images Find K-nearest neighbors for each point (K=4) For each image Select M candidate matching images by counting matched keypoints (m=6) Solve homography H ij for each matched image Decide if match is valid ( n i > 8 + 0.3 n f ) # inliers # keypoints in overlapping area
38.Recognizing Panoramas (cont.) (now we have matched pairs of images) Find connected components
39.Finding the panoramas
40.Finding the panoramas
41.Finding the panoramas
42.Recognizing Panoramas (cont.) (now we have matched pairs of images) Find connected components For each connected component Perform bundle adjustment to solve for rotation ( θ 1 , θ 2 , θ 3 ) and focal length f of all cameras Project to a surface (plane, cylinder, or sphere) Render with multiband blending
43.Bundle adjustment for stitching Non-linear minimization of re-projection error where H = K ’ R ’ R -1 K -1 Solve non-linear least squares ( Levenberg -Marquardt algorithm) See paper for details
44.Bundle Adjustment New images initialised with rotation, focal length of best matching image
45.Bundle Adjustment New images initialised with rotation, focal length of best matching image
46.Straightening Rectify images so that “up” is vertical
47.Details to make it look good Choosing seams Blending
48.Choosing seams Image 1 Image 2 x x im1 im2 Easy method A ssign each pixel to image with nearest center
49.Choosing seams Easy method Assign each pixel to image with nearest center Create a mask: mask(y, x) = 1 iff pixel should come from im1 Smooth boundaries (called “feathering”): mask_sm = imfilter (mask, gausfil ); Composite i mblend = im1_c.*mask + im2_c.*(1-mask); Image 1 Image 2 x x im1 im2
50.Choosing seams Better method: dynamic program to find seam along well-matched regions Illustration: http://en.wikipedia.org/wiki/File:Rochester_NY.jpg
51.Gain compensation Simple gain adjustment Compute average RGB intensity of each image in overlapping region Normalize intensities by ratio of averages
52.Multi-band Blending Burt & Adelson 1983 Blend frequency bands over range l
53.Multiband Blending with Laplacian Pyramid 0 1 0 1 0 1 Left pyramid Right pyramid blend At low frequencies, blend slowly At high frequencies, blend quickly
54.Multiband blending Compute Laplacian pyramid of images and mask Create blended image at each level of pyramid Reconstruct complete image Laplacian pyramids
55.Blending comparison (IJCV 2007)
56.Blending Comparison
57.Further reading DLT algorithm: HZ p. 91 ( alg 4.2), p. 585 Normalization: HZ p. 107-109 ( alg 4.2) RANSAC: HZ Sec 4.7, p. 123, alg 4.6 Rick Szeliski’s alignment/stitching tutorial Recognising Panoramas : Brown and Lowe, IJCV 2007 (also bundle adjustment)
58.How does iphone panoramic stitching work? Capture images at 30 fps Stitch the central 1/8 of a selection of images Select which images to stitch using the accelerometer and frame-to-frame matching Faster and avoids radial distortion that often occurs towards corners of images Alignment Initially, perform cross-correlation of small patches aided by accelerometer to find good regions for matching Register by matching points (KLT tracking or RANSAC with FAST (similar to SIFT) points) or correlational matching Blending Linear (or similar) blending, using a face detector to avoid blurring face regions and choose good face shots (not blinking, etc ) http:// www.patentlyapple.com/patently-apple/2012/11/apples-cool-iphone-5-panorama-app-revealed-in-5-patents.html
59.Things to remember Homography relates rotating cameras Recover homography using RANSAC and normalized DLT Bundle adjustment minimizes reprojection error for set of related images Details to make it look nice (e.g., blending)
60.See you on Thrusday Next class: Epipolar Geometry and Stereo Vision