Camera calibration by Zhang

Similar documents
3D from Photographs: Camera Calibration. Dr Francesco Banterle

Pose Tracking II! Gordon Wetzstein! Stanford University! EE 267 Virtual Reality! Lecture 12! stanford.edu/class/ee267/!

Theory of Bouguet s MatLab Camera Calibration Toolbox

Camera Calibration The purpose of camera calibration is to determine the intrinsic camera parameters (c 0,r 0 ), f, s x, s y, skew parameter (s =

CS4495/6495 Introduction to Computer Vision. 3D-L3 Fundamental matrix

Pose estimation from point and line correspondences

Augmented Reality VU Camera Registration. Prof. Vincent Lepetit

Camera calibration. Outline. Pinhole camera. Camera projection models. Nonlinear least square methods A camera calibration tool

Visual Object Recognition

EE Camera & Image Formation

Camera calibration Triangulation

CS 231A Computer Vision (Fall 2011) Problem Set 2

Homographies and Estimating Extrinsics

Camera Calibration. (Trucco, Chapter 6) -Toproduce an estimate of the extrinsic and intrinsic camera parameters.

Multi-Frame Factorization Techniques

Structure from Motion. CS4670/CS Kevin Matzen - April 15, 2016

EPIPOLAR GEOMETRY WITH MANY DETAILS

Transformations. Lars Vidar Magnusson. August 24,

Introduction to pinhole cameras

A Study of Kruppa s Equation for Camera Self-calibration

Multiple View Geometry in Computer Vision

ANALYTICAL IMAGE FEATURES

Lecture 5. Epipolar Geometry. Professor Silvio Savarese Computational Vision and Geometry Lab. 21-Jan-15. Lecture 5 - Silvio Savarese

A Practical Method for Decomposition of the Essential Matrix

Lecture 16: Projection and Cameras. October 17, 2017

Sparse Levenberg-Marquardt algorithm.

Deuxième examen partiel A 2013

Camera Models and Affine Multiple Views Geometry

16. Analysis and Computation of the Intrinsic Camera Parameters

Visual SLAM Tutorial: Bundle Adjustment

Chapter 3 Numerical Methods

CSE 252B: Computer Vision II

Optimisation on Manifolds

Algorithms for Computing a Planar Homography from Conics in Correspondence

Determining the Translational Speed of a Camera from Time-Varying Optical Flow

Camera Projection Model

Numerical Linear Algebra Homework Assignment - Week 2

Minimal representations of orientation

13. Nonlinear least squares

CSE 252B: Computer Vision II

Determining absolute orientation of a phone by imaging celestial bodies

OPPA European Social Fund Prague & EU: We invest in your future.

MATH 1003 Review: Part 2. Matrices. MATH 1003 Review: Part 2. Matrices

Induced Planar Homologies in Epipolar Geometry

Linear Algebra review Powers of a diagonalizable matrix Spectral decomposition

Verifying Global Minima for L 2 Minimization Problems

Kalman Filter. Predict: Update: x k k 1 = F k x k 1 k 1 + B k u k P k k 1 = F k P k 1 k 1 F T k + Q

AN ITERATION. In part as motivation, we consider an iteration method for solving a system of linear equations which has the form x Ax = b

Numerical computation II. Reprojection error Bundle adjustment Family of Newtonʼs methods Statistical background Maximum likelihood estimation

STA 414/2104: Lecture 8

Tracking for VR and AR

ME751 Advanced Computational Multibody Dynamics

Linear Algebra & Geometry why is linear algebra useful in computer vision?

NATIONAL BOARD FOR HIGHER MATHEMATICS. M. A. and M.Sc. Scholarship Test. September 19, Time Allowed: 150 Minutes Maximum Marks: 30

Computational Methods. Least Squares Approximation/Optimization

Self-Calibration of a Moving Camera by Pre-Calibration

Multiple View Geometry in Computer Vision

EE 267 Virtual Reality Course Notes: 6-DOF Pose Tracking with the VRduino

MATH 315 Linear Algebra Homework #1 Assigned: August 20, 2018

Supplementary Figure 2: One- sided arrangements of transducer. a) flat: 8x8. b) V- shape: 5x6 per side. c) hemispherical cap with 52 transducers.

Name: MATH 3195 :: Fall 2011 :: Exam 2. No document, no calculator, 1h00. Explanations and justifications are expected for full credit.

MECH 576 Geometry in Mechanics November 30, 2009 Kinematics of Clavel s Delta Robot

Linear Algebra & Geometry why is linear algebra useful in computer vision?

The Multibody Trifocal Tensor: Motion Segmentation from 3 Perspective Views

A Stellar Gyroscope for CubeSat Attitude Determination

PAijpam.eu EPIPOLAR GEOMETRY WITH A FUNDAMENTAL MATRIX IN CANONICAL FORM Georgi Hristov Georgiev 1, Vencislav Dakov Radulov 2

Vision 3D articielle Session 2: Essential and fundamental matrices, their computation, RANSAC algorithm

Linear Algebra review Powers of a diagonalizable matrix Spectral decomposition

Trinocular Geometry Revisited

Bundle Adjustment for 3-D Reconstruction: Implementation and Evaluation

Matrices (Ch.4) MATH 1003 Review: Part 2. Matrices. Matrices (Ch.4) Matrices (Ch.4)

Practical rotation angle measurement method by monocular vision

Upon successful completion of MATH 220, the student will be able to:

Control de robots y sistemas multi-robot basado en visión

Recovering Unknown Focal Lengths in Self-Calibration: G.N. Newsam D.Q. Huynh M.J. Brooks H.-P. Pan.

Rich Tomography. Bill Lionheart, School of Mathematics, University of Manchester and DTU Compute. July 2014

Chapter 4 Systems of Linear Equations; Matrices

Lie Groups for 2D and 3D Transformations

Basic Math for

Camera Self-Calibration Using the Singular Value Decomposition of the Fundamental Matrix

. =. a i1 x 1 + a i2 x 2 + a in x n = b i. a 11 a 12 a 1n a 21 a 22 a 1n. i1 a i2 a in

Activity: Derive a matrix from input-output pairs

Final Exam Due on Sunday 05/06

Image Transform. Panorama Image (Keller+Lind Hall)

Introduction to Mobile Robotics Compact Course on Linear Algebra. Wolfram Burgard, Cyrill Stachniss, Kai Arras, Maren Bennewitz

NTUA. A. Georgakopoulou. A. Papayannis1, A. Aravantinos2 NATIONAL TECHNICAL UNIVERSITY OF ATHENS TECHNOLOGICAL EDUCATIONAL INSTIDUTION OF ATHENS SIENA

Lecture'8:'' Camera'Models'

Holography and Optical Vortices

Elementary Linear Algebra Review for Exam 2 Exam is Monday, November 16th.

Math 2114 Common Final Exam May 13, 2015 Form A

ECE 521. Lecture 11 (not on midterm material) 13 February K-means clustering, Dimensionality reduction

Solution: a) Let us consider the matrix form of the system, focusing on the augmented matrix: 0 k k + 1. k 2 1 = 0. k = 1

Principal Components Analysis. Sargur Srihari University at Buffalo

Diagonalizing Matrices

Linear and Nonlinear Optimization

Linear Equations and Graphs Linear Equations and Inequalities

Uncertainty Models in Quasiconvex Optimization for Geometric Reconstruction

MATH10212 Linear Algebra B Homework Week 5

Lecture «Robot Dynamics» : Kinematics 3

Fixed Perimeter Rectangles

Transcription:

Camera calibration by Zhang Siniša Kolarić <http://www.inf.puc-rio.br/~skolaric> September 2006 Abstract In this presentation, I present a way to calibrate a camera using the method by Zhang. NOTE. This is accompanying material to my trabalhos for the course INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa held by prof. Marcelo Gattass, during the 2006.2 semestre.

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [1] The problem Given a set of photos (either real photos made with a real camera, or virtual photos made with a virtual 1 camera), determine camera s: Intrinsic parameters Extrinsic parameters 1 For example the one implemented with perspective transformation in OpenGL, or one implemented in a raytracer.

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [2] Camera s intrinsic parameters Scaling factors s x, s y Image center (principle point) (o x, o y ) Focal length(s) f(f x = f/s x, f y = f/s y ) Aspect ratio (skewness) s h Lens distortion (pin-cushion effect) k 1, k 2

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [3] Camera s intrinsic matrix (Trucco & Verri) K = f sx s h o x o y 0 f sy 0 0 1 = f x s h o x 0 f y o y 0 0 1 f focal length in [m] s x, s y scale factors in the image s u and v axis. Can be interpreted as the horizontal and vertical size (in meters) of the pixels, in another words dimensionality of s x, s y is [m/pixel]. f x, f y focal lengths in [pixel]. s h skewness of two image axes (dimensionless). Holds s h = tan δ 0 (because generally δ 0), where δ is the angle between axis y and verticals on the axis x. (o x, o y ) coordinate pair of the principal point (intersection of optical axis with image plane), expressed in [pixel]. Also called image center.

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [4] Camera s intrinsic matrix (Faugeras) K = fk u 0 u 0 0 fk v v 0 0 0 1 Remarks: no skewness factor k u = s 1 x, k v = s 1 y

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [5] Camera s intrinsic matrix (IMPA folks) K = fs x fτ u c 0 fs y v c 0 0 1 Compared with Trucco/Verri and Faugeras, IMPA people have added the following changes: change of sign for diagonal elements k 11, k 22 s x, s y are defined as inverted values of s x, s y in Trucco/Verri notation

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [6] Camera s intrinsic matrix Having images only, it s not possible to estimate individual values of f, s x, s y ; only values f x and f y can be estimated However if the manufacturer supplied s x, s y with the camera, it s possible to derive f If we discover f x, it will be expressed in [pixel]. So if we know the height H of the image (also expressed in [pixel]), we can calculate fov y.

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [7] Camera s extrinsic parameters Placement of the camera (translation vector t) Orientation of the camera (rotation matrix R)

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [8] Complete chain of coordinate transforms pixels 1 s sx h 0 1 s y o x o y 0 0 1 image f 0 0 0 0 f 0 0 0 0 1 0 camera [ R t 0 1 ] world Combining first two matrices we get: pixels pixels f sx s h o x o y 0 f sy 0 0 1 f x s h o x 0 f y o y 0 0 1 camera camera [ R t 0 1 [ R t 0 1 ] world ] world

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [9] Zhang s method ZHANG() 1 take several(n 3) photos of your planar model s printout 2 detect features in photos using LoG, jvinterpret(), etc 3 calculate camera s extrinsic and intrinsic parms using closed-form solution 4 calculate coeffs for radial distortion solving linear least-squares 5 fine tune calculated parms using Levenberg-Marquardt 6 output calculated parms There can be less than 3 photos, but only under the supposition that some intrinsic parameters are known, see below.

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [10] Zhang s method Firstly, the standard pinhole camera is being considered Then, radial distortion is being calculated on top of it

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [11] Zhang uses planar 3-D models Planar means that we can flatten coordinate Z of every point of the model in the Zhang method, that is, consider Z to be 0. Examples of planar 3-D models would be, for example, patterns of black rectangles with known dimensions, printed on a paper, glued to a hard-cover book, and photographed by a camera. Therefore, [X Y Z 1] τ (a 3-D point of the model) can be treated as [X Y 1] τ in all subsequent calculations, since Z = 0 for all points.

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [12] General projective transformation can be simplified Because of the simplification [X Y Z 1] τ [X Y 1] τ, we can simplify the general projective transformation as [X Y Z 1] τ K[R t][x Y Z 1] τ [X Y 1] τ K[r 1 r 2 t][x Y 1] τ where r 1 and r 2 are the first two columns of rotation matrix R, t translation vector, and K intrinsic matrix. By this reduction, we can work with a simpler projective plane to projective plane transformation (P 2 P 2 ) instead with the more general and more complex (P 3 P 2 ) transformation.

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [13] Homography Because it uses planar 3-D models, Zhang s method makes use of a homography (which is a map from projective plane P 2 onto itself): where [X Y 1] τ K[R t][x Y 1] τ = 1 λ H[X Y 1]τ = [u v 1] τ H is a homography from the model plane to the image plane P 2 P 2 defined as H = λ K[R t] K is camera s intrinsic matrix, and R, t extrinsic matrices

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [14] Homography There is a factor λ in the definition of H because any homography is defined up to a factor.

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [15] The idea behind the Zhang method Let M designate the set of 2-D model points, and M i set of 2-D points detected in image i. In a nutshell, the idea is first to extract n homographies H i (3x3 matrices) from n pairs {M, M i }, i = 1,... n: ] {M, M 1} H 1 = {M, M 2} H 2 = {M, M n} H n = [ 1h11 1 h12 1 h13 1 h21 1 h22 1 h23 1 h31 1 h32 1 h33 [ 2h11 2 h12 2 h13 2 h21 2 h22 2 h23 2 h31 2 h32 2 h33 [ nh11 n h12 n h13 ] ] n n n h21 h22 h23 n n n h31 h32 h33

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [16] The idea behind the Zhang method Then we use these newly-found coefficients of H i (eight coefficients for each H i, because all homographies have 8 DOF, that is, are determined up to a factor) to setup a linear system of 2n (n = number of images) equations for five intrinsic parameters (unknowns) s x, s y, γ, u 0, v 0 elements of K. Thus in this way, we end up finding (estimating) intrinsic matrix K. With K in hand, we find extrinsics R = [ r 1, r 2, r 3 ] and t for each image i: r 1 = λk 1 h1 r 2 = λk 1 h2 r 3 = r 1 r 2 t = λk 1 h3

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [17] The idea behind the Zhang method Please note that n matrices R i so calculated do not in general case satisfy the properties of rotation matrix (that is, columns and rows of R i aren t unitary orthogonal vectors) due to inherent noise in data. There is a method, however, that allows us to find a rotation matrix that is most similar to R i see the article by Zhang. Of course, noise also affects the other extrinsic parameter t i.

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [18] The linear system A couple of remarks about the aforementioned linear system for s x, s y, γ, u 0, v 0. For each image i (and thus each homography H i = K[r 1i r 2i t i ]), we have a pair of constraining equations: h τ 1iK τ K 1 h 2i = 0 h τ 1iK τ K 1 h 1i = h τ 2iK τ K 1 h 2i where H i = [h 1i h 2i h 3i ] and h 1i, h 2i, h 3i are columns of H i. Since h 1i, h 2i, h 3i are knowns, unknowns are six (6) coefficients of B := K τ K 1. Also, every such pair of equations gives constraints for two (2 = 8 6) intrinsics, since a homography has 8 DOF and there are 6 extrinsic parameters.

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [19] The linear system If: n = 1 then we can only solve two intrinsic parameters, for example s x and s y. In this case, we set u 0 = W 2, v 0 = H 2, γ = 0, that is, u 0, v 0 are at the image center, and skewness is zero. n = 2 then we can solve four intrinsic parameters, for example s x, s y, u 0, v 0. In this case, we set γ = 0. n 3 the linear system becomes overdetermined, so we have a unique solution (up to a factor) for all five intrinsics s x, s y, γ, u 0, v 0.

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [20] This was just an estimate Finally, matrix K, matrices R i, and vectors t i estimate of the ground truth. so calculated, are just an To improve the accuracy of results, matrix K, matrices R i, and vectors t i will be fed into a nonlinear-minimization solver. That is, matrix K, matrices R i, and vectors t i are treated as an initial guess for further refinement.

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [21] Minimizing a functional In other words, now it s necessary to minimize the following functional: n i=1 m m ij ˆ m(k, R i, t i, M j ) 2 j=1 where m ij is an observed (detected) point j in image i, and ˆ m(k, R i, t i, M j ) is the (re)projection of model point M j onto image i using estimated K, R i, t i

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [22] Minimizing a functional Therefore, ˆ m is an estimate: ˆ m(k, R i, t i, M j ) = H[X Y 1] τ j = K[r 1 r 2 t][x Y 1] τ j The nonlinear minimization solver usually used for the aforementioned problem is Levenberg-Marquardt solver.

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [23] Camera s optical center in planar model s space One of the tasks was to find the position of the camera s optical centre C expressed in the coordinate system defined by image i (that is, coordinate system defined by the pose of calibration pattern during which image i has been taken). getcoordsofcamerasopticalcentreinimagesystem() 1 get extrinsics matrix [R t] for image i, where t = [t 1, t 2, t 3 ] τ 2 return R τ ( t)

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [24] Camera s optical center in planar model s space EXPLANATION. Let points O im and O cam be origins of the image system and the camera system, respectively, in an absolute system. Let t be the vector that gives the position of O im in the camera system. Let r 1, r 2, r 3 define the unitary base of the image system (in relation to the unitary base of the camera system). Because of this, matrix R which translates image s canonical base { i, j, k } into camera s canonical base { i, j, k}, has columns r 1, r 2, r 3 and is an unitary matrix, RR τ = R τ R = I. In other words, matrix R rotates (but only after translation t ) image points into their corresponding camera points. Therefore, given a point with image coordinates P im = (X, Y, Z = 0), its coordinates P cam in the camera system are equal to the coordinates of the vector O cam P im = O cam O im + O im P im P cam = t + RP im

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [25] Camera s optical center in planar model s space Now using the fact that RR τ = R τ R = I, and multiplying P cam = t + RP im by R τ from the left side: R τ P cam = R τ t + R τ RP im = R τ t + P im P im = R τ P cam R τ t Therefore, given a point expressed in camera coordinates (P cam ), we can calculate its image coordinates (P im ). Finally, in the special case P cam = O cam = (0, 0, 0) cam, the formula above gives: P im = R τ P cam R τ t = R τ t = R τ ( t) and this way we get optical centre O cam expressed in image coordinates.

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [26] Camera s optical center in planar model s space Using homogenuous coordinates, matrix [R t] transforms image coordinates into camera coordinates. More precisely: [ R t 0 3 1 ] P = r 11 r 12 r 13 t 1 r 21 r 22 r 23 t 2 r 31 r 32 r 33 t 3 0 0 0 1 where P = (X, Y, Z, 1) and P = [X, Y, Z, 1]. P = P

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [27] Calculating fov y How to calculate fov y for image i, from the intrinsics matrix K i = {k ij }? Holds tan fov y = H/2 2 f y where H is the height of image expressed in pixels, and f y = k 22 is the focal length in the y direction, also expressed in pixels. Now fov y = 2 arctan H/2 f y [rad] Finally, fov y 360 2π [rad] is the field of view expressed in degrees.

INF2064 Tópicos de Computação Gráfica III - Realidade Aumentada e Cooperativa Camera calibration by Zhang [28] References A flexible new technique for camera calibration, Zhengyou Zhang, Technical Report MSR-TR-98-71 (report last updated on March 25, 1999)