Agenda. Rotations. Camera calibration. Homography. Ransac

Similar documents
Agenda. Rotations. Camera models. Camera calibration. Homographies

Agenda. Perspective projection. Rotations. Camera models

Geometric camera models and calibration

Homogeneous Coordinates. Lecture18: Camera Models. Representation of Line and Point in 2D. Cross Product. Overall scaling is NOT important.

Vision Review: Image Formation. Course web page:

3D Geometry and Camera Calibration

calibrated coordinates Linear transformation pixel coordinates

Pin Hole Cameras & Warp Functions

Camera Model and Calibration

N-Views (1) Homographies and Projection

Image warping and stitching

Pin Hole Cameras & Warp Functions

Image warping and stitching

Introduction to Computer Vision

Visual Recognition: Image Formation

Week 2: Two-View Geometry. Padua Summer 08 Frank Dellaert

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

Camera Model and Calibration. Lecture-12

Humanoid Robotics. Projective Geometry, Homogeneous Coordinates. (brief introduction) Maren Bennewitz

Augmented Reality II - Camera Calibration - Gudrun Klinker May 11, 2004

Camera Calibration. COS 429 Princeton University

MERGING POINT CLOUDS FROM MULTIPLE KINECTS. Nishant Rai 13th July, 2016 CARIS Lab University of British Columbia

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

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

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

Instance-level recognition I. - Camera geometry and image alignment

Perspective projection and Transformations

Perspective Projection [2 pts]

Assignment 2 : Projection and Homography

Mosaics. Today s Readings

Camera Geometry II. COS 429 Princeton University

Image Transformations & Camera Calibration. Mašinska vizija, 2018.

CS 664 Slides #9 Multi-Camera Geometry. Prof. Dan Huttenlocher Fall 2003

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

Two-view geometry Computer Vision Spring 2018, Lecture 10

CS6670: Computer Vision

Computer Vision Projective Geometry and Calibration. Pinhole cameras

Image Warping and Mosacing

Stereo and Epipolar geometry

Outline. ETN-FPI Training School on Plenoptic Sensing

Computer Vision I Name : CSE 252A, Fall 2012 Student ID : David Kriegman Assignment #1. (Due date: 10/23/2012) x P. = z

CS4670: Computer Vision

Structure from Motion

Projective Geometry and Camera Models

Midterm Examination CS 534: Computational Photography

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

Rectification and Distortion Correction

Homographies and RANSAC

CSE 252B: Computer Vision II

Lecture 3: Camera Calibration, DLT, SVD

Midterm Exam Solutions

Rigid Body Motion and Image Formation. Jana Kosecka, CS 482

3-D D Euclidean Space - Vectors

Image warping and stitching

Structure from motion

Computer Vision Projective Geometry and Calibration

Single View Geometry. Camera model & Orientation + Position estimation. What am I?

CS231A Course Notes 4: Stereo Systems and Structure from Motion

CSE 252B: Computer Vision II

Computer Vision Projective Geometry and Calibration. Pinhole cameras

Unit 3 Multiple View Geometry

METRIC PLANE RECTIFICATION USING SYMMETRIC VANISHING POINTS

COMP 558 lecture 19 Nov. 17, 2010

Pinhole Camera Model 10/05/17. Computational Photography Derek Hoiem, University of Illinois

Module 4F12: Computer Vision and Robotics Solutions to Examples Paper 2

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

CS201 Computer Vision Camera Geometry

Robust Geometry Estimation from two Images

An idea which can be used once is a trick. If it can be used more than once it becomes a method

GEOMETRIC TRANSFORMATIONS AND VIEWING

Specifying Complex Scenes

Planar homographies. Can we reconstruct another view from one image? vgg/projects/singleview/

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

Epipolar Geometry Prof. D. Stricker. With slides from A. Zisserman, S. Lazebnik, Seitz

Geometric Transformations and Image Warping

ROBUST LINE-BASED CALIBRATION OF LENS DISTORTION FROM A SINGLE VIEW

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

CV: 3D sensing and calibration

Camera model and multiple view geometry

An introduction to 3D image reconstruction and understanding concepts and ideas

Perspective Projection Describes Image Formation Berthold K.P. Horn

CS231A Midterm Review. Friday 5/6/2016

Image stitching. Announcements. Outline. Image stitching

Camera models and calibration

3D Sensing. 3D Shape from X. Perspective Geometry. Camera Model. Camera Calibration. General Stereo Triangulation.

Image Formation. Antonino Furnari. Image Processing Lab Dipartimento di Matematica e Informatica Università degli Studi di Catania

Projective Geometry and Camera Models

CSE152a Computer Vision Assignment 1 WI14 Instructor: Prof. David Kriegman. Revision 0

Vector Algebra Transformations. Lecture 4

CSE 252B: Computer Vision II

Epipolar Geometry and Stereo Vision

Computer Vision cmput 428/615

CS223b Midterm Exam, Computer Vision. Monday February 25th, Winter 2008, Prof. Jana Kosecka

3D Mathematics. Co-ordinate systems, 3D primitives and affine transformations

Autonomous Navigation for Flying Robots

Hartley - Zisserman reading club. Part I: Hartley and Zisserman Appendix 6: Part II: Zhengyou Zhang: Presented by Daniel Fontijne

Short on camera geometry and camera calibration

1 Projective Geometry

3D Geometry and Camera Calibration

EE795: Computer Vision and Intelligent Systems

Transcription:

Agenda Rotations Camera calibration Homography Ransac

Geometric Transformations y x Transformation Matrix # DoF Preserves Icon translation rigid (Euclidean) similarity affine projective h I t h R t h sr t h A h H i i i i i orientation lengths S S 4 angles S S 6 parallelism 8 straight lines `` Let s define families of transformations by the properties that they preserve

Rotations Linear transformations that preserve distances and angles Definition: an orthogonal transformation perserves dot products a T b = F (a) T F (b) where F (a) =Aa, a R n,a R n n a T b = a T A T Ab () A T A = I [can conclude by setting a,b = coordinate vectors] Defn: A is a rotation matrix if A T A = I, det(a) = Defn: A is a reflection matrix if A T A = I, det(a) = -

D Rotations R = apple cos sin sin cos DOF

D Rotations R X 4Y 5 = Z r r r 4r r r 5 r r r X 4Y 5 Z Think of as change of basis where ri = r(i,:) are orthonormal basis vectors r rotated coordinate frame r r How many DOFs? = ( to point r + to rotate along r)

D Rotations Lots of parameterizations that try to capture DOFs Helpful one for vision: axis-angle representation Represent a D rotation with a unit vector that represents the axis of rotation, and an angle of rotation about that vector -vs- D D

Recall: cross-product Dot product: a b = a b cos Cross product: i j k a a a b b b = a a b b i a a b b j + a a b b k Cross product matrix: a b = âb = 4 0 a a b a 0 a 5 4b 5 a a 0 b

Approach! R,! = x

Approach! R,! = x k x? x. Write as x as sum of parallel and perpindicular component to omega. Rotate perpindicular component by D rotation of theta in plane orthogonal to omega R = I +ŵ sin +ŵŵ( cos ) [Rx can simplify to cross and dot product computations]

Exponential map! R,! = x k x? x R =exp(ˆv), where v =! = I +ˆv +! ˆv +... [standard Taylor series expansion of exp(x) @ x=0 as + x + (/!)x + ] Implication: we can approximate change in position due to a small rotation as v x,

Agenda Rotations Camera calibration Homography Ransac

Perspective projection y x (x,y,) (X,Y,Z) COP z [right-handed coordinate system] x = f Z X y = f Z Y

Perspective projection revisited x 4y5 = f 0 0 40 f 05 0 0 X 4Y 5 Z Given (X,Y,Z) and f, compute (x,y) and lambda: x = fx = Z x = x = fx Z

Special case: f = Natural geometric intuition: D point is obtained by scaling ray pointed at image coordinate Scale factor = true depth of point (x,y,) (X,Y,Z) COP Z x 4y5 = X 4Y 5 Z [Aside: given an image with a focal length f, resize by /f to obtain unit-focal-length image]

Homogenous notation For now, think of above as shorthand notation for 4 x y z 5 4 X Y Z 5 4 x y z 5 4 X Y Z 5 9 s.t. 4 x y z 5 = 4 X Y Z 5

Camera projection x 4y5 = f 0 0 r r r t x 40 f 05 4r r r t 5 y 0 0 Camera instrinsic matrix K (can include skew & non-square pixel size) r r r t z Camera extrinsics (rotation and translation) X 6Y 4Z 7 5 D point in world coordinates r r camera r T world coordinate frame Aside: homogenous notation is shorthand for x = x

Fancier intrinsics x s = s x x y s = s y y x 0 = x s + o x y 0 = y s + o y x =x 0 + s y 0 } } non-square pixels shifted origin y skewed image axes x K = s x s o x 4 0 s y o 5 y 0 0 f 0 0 40 f 05 = 0 0 fs x fs o x 4 0 fs y o 5 y 0 0

Notation [Using Matlab s rows x columns] X x fs x fs o x r r r t x 4y5 = 4 0 fs y o y 5 4r r r t y 5 6Y 7 4Z 5 0 0 r r r t z X = K R T 6Y 7 4Z 5 X = M 4 6Y 7 4Z 5 Claims (without proof):. A x4 matrix M can be a camera matrix iff det(m) is not zero. M is determined only up to a scale factor

Notation (more) M 4 X 6Y 4Z 7 5 = A b = A X 6Y 4Z X 4Y 5 + b Z 7 5 M = m T 4m T m T 5, A = a T 4a T a T 5, b = b 4b 5 b

Applying the projection matrix x = ( X Y Z a + b ) y = ( X Y Z a + b ) = X Y Z a + b Set of D points that project to x = 0: Set of D points that project to y = 0: X Y Z a + b =0 X Y Z a + b =0 Set of D points that project to x = inf or y = inf: X Y Z a + b =0

Rows of the projection matrix describe the planes defined by the image coordinate system a y a COP a x image plane

Other geometric properties (x,y) COP (X,Y,Z) What s set of (X,Y,Z) points that project to same (x,y)? X x 4Y 5 = w + b where w = A 4y5,b= A b Z What s the position of COP / pinhole? X A 4Y 5 + b =0 ) Z X 4Y 5 = A b Z

Affine Cameras m T = 0 0 0 x = X Y Z a + b y = X Y Z a + b Image coordinates (x,y) are an affine function of world coordinates (X,Y,Z) Affine transformations = linear transformations plus an offset Example: Weak-perspective projection model Projection defined by 8 parameters Parallel lines are projected to parallel lines The transformation can be written as a direct linear transformation

Geometric Transformations Euclidean (trans + rot) preserves lengths + angles Affine: preserves parallel lines Projective: preserves lines Projective Affine Euclidean

Agenda Rotations Camera calibration Homography Ransac

Calibration: Recover M from scene points P,..,P N and the corresponding projections in the image plane p,..,p N Find M that minimizes the distance between the actual points in the image, p i, and their predicted projections MP i Problems: The projection is (in general) non-linear M is defined up to an arbitrary scale factor

PnP = Perspective n-point

i MP i p i T i T i i T i T i P m P m v P m P m u = = 0 ) ( 0 ) ( = = i i T i T i i T i T v P m P m u P m P m Write relation between image point, projection matrix, and point in space: Write non-linear relations between coordinates: Make them linear: The math for the calibration procedure follows a recipe that is used in many (most?) problems involving camera geometry, so it s worth remembering:

0 0 0 0 0 = m P v P P u P P v P P u P T N N T N T N N T N T T T T Put all the relations for all the points into a single matrix: = = 0 0 0 m m m m m P v P u P P T i i T i i T i T i Write them in matrix form: In noise-free case: Lm = 0 (vector of 0 s)

What about noisy case? min m = Lm Min right singular vector of L (or eigenvector of L T L) Is this the right error to minimize? If not, what is?

P z x y P i (u i,v i ) (u,v ) MP i Ideal error + i i i i i i P m P m v P m P m u Error(M) = Initialize nonlinear optimization with algebraic solution

Radial Lens Distortions

Radial Lens Distortions No Distortion Barrel Distortion Pincushion Distortion

Correcting Radial Lens Distortions Before After http://www.grasshopperonline.com/barrel_distortion_correction_software.html

Overall approach Minimize reprojection error: Error(M,k s) Initialize with algebraic solution (approaches in literature based on various assumptions)

Revisiting homographies Place world coordinate frame on object plane x 4y5 = f 0 0 r r r t x 40 f 05 4r r r t 5 y 0 0 r r r t z X 6Y 4 0 7 5

Projection of planar points x 4y5 = f 0 0 r r r t x 40 f 05 4r r r t 5 y 0 0 r r r t z f 0 0 r r t x X = 40 f 05 4r r t 5 4 y Y 0 0 r r t z fr fr ft x X = 4fr fr ft 5 4 y Y 5 r r t z Convert between D location on object plane and image coordinate with a X matrix H (Above holds for any instrinc matrix K) 5 X 6Y 4 0 7 5

Two-views of a plane Image correspondences 4 4 x y x y X 5 = H 4 Y 5 X 5 = H 4 Y 5 4 x y 5 = H H x 4y 5 [LHS and RHS are related by a scale factor] [Aside: H usually invertible] 4 5 4 5

Computing homography projections Given (x,y) and H, how do we compute (x,y)? 4 x y 5 = a b c 4d e f5 g h i x 4y 5 x = x = ax + by + c gx + hy + i Is this operation linear in H or (x,y)?

How many corresponding points needed? How many degrees of freedom in H? Estimating homographies Given corresponding D points in left and right image, estimate H Image correspondences x (gx + hy + i) =ax + by + c... AH(:) = 0 6 4 07 5. Homogenous linear system

Estimating homographies Given corresponding D points in left and right image, estimate H Image correspondences AH(:) = 0 6 4 07 5. H is determined only up to scale factor (8 DOFs) Need 4 points minimum. How to handle more points? min H(:) = AH(:) Minimum right singular vector of A (eigenvector of A T A)

Frontalizing planes using homographies Estimate homography on (at least) 4 pairs of corresponding points (e.g., corners of quad/rect) Apply homography on all (x,y) coordinates inside target rectangle to compute source pixel location

Frontalizing planes using homographies

hies are derived from the corresponding points, forming a mosaic cally is shaped like a bow-tie, as images farther away from the are warped outward to fit the homography. The figure below is efeys and Hartley & Zisserman. Special case of views: rotations about camera center Can be modeled as planar transformations, regardless of scene geometry! (a) incline L.jpg (img) (b) incline R.jpg (img) (c) img warped to img s frame Figure 5: Example output for Q6.: Original images img and img (left and center) and img warped to fit img (right). Notice that the warped image clips out of the image. We will fix this in Q6. Figure 6: Final panorama view. With homography estimated with

Derivation 4 4 4 X Y Z x y x y 5 = R 5 = X 4Y 5 Z f 0 0 4 0 f 05 0 0 5 = K RK 4 K x y 4 5 X Y Z 5

Take-home points for homographies 4 x y 5 = a b c 4d e f5 g h i x 4y 5 If camera rotates about its center, then the images are related by a homography irrespective of scene depth. If the scene is planar, then images from any two cameras are related by a homography. Homography mapping is a x matrix with 8 degrees of freedom.

Matching features What do we do about the bad matches?

General problem: we are trying to fit a (geometric) model to noisy data How about we choose the average vector (least-squares soln)? Why will/won t this work? 49

x Let s generalize the problem a bit Estimate best model (a line) that fits data {x i,y i } min w,b X (y i f w,b (x i )) i f w,b (x i )=wx i + b y

Let s generalize the problem a bit Least-squares solution y x

RANSAC Line Fitting Example Sample two points

RANSAC Line Fitting Example Fit Line

RANSAC Line Fitting Example Total number of points within a threshold of line.

RANSAC Line Fitting Example Repeat, until get a good result

RANSAC Line Fitting Example Repeat, until get a good result

RANSAC Line Fitting Example Repeat, until get a good result

RAndom SAmple Consensus Select one match, count inliers

RAndom SAmple Consensus Select one match, count inliers

Least squares fit Find average translation vector for the largest group of inliers

RANSAC for estimating transformation RANSAC loop:. Select feature pairs (at random). Compute transformation T (exact). Compute inliers (point matches where p i - T p i < ε) 4. Keep largest set of inliers 5. Re-compute least-squares estimate of transformation T using all of the inliers

RANSAC for estimating transformation RANSAC loop:. Select feature pairs (at random). Compute transformation T (exact). Compute inliers (point matches where p i - T p i < ε) 4. Keep largest set of inliers 5. Re-compute least-squares estimate of transformation T using all of the inliers Recall homography estimation: how do we estimate with all inlier points? Ah =0, A R 8X9 h, 0 R 9

RANSAC for estimating transformation RANSAC loop:. Select feature pairs (at random). Compute transformation T (exact). Compute inliers (point matches where p i - T p i < ε) 4. Keep largest set of inliers 5. Re-compute least-squares estimate of transformation T using all of the inliers Recall homography estimation: how do we estimate with all inlier points? Ah =0, A R 8X9 h, 0 R 9

RANSAC for alignment

RANSAC for alignment

RANSAC for alignment

Planar object recognition (what is transformation used; how many pairs must be selected in initial step?