510 likes | 726 Views
3-D Computer Vision CSc 83020. Camera Calibration. Camera Calibration. Problem: Estimate camera’s extrinsic & intrinsic parameters. Method: Use image(s) of known scene. Tools: Geometric camera models. SVD and constrained least-squares. Line extraction methods. Camera Calibration.
E N D
3-D Computer VisionCSc 83020 Camera Calibration CSc 83020 3-D Computer Vision – Ioannis Stamos
Camera Calibration • Problem: Estimate camera’s extrinsic & intrinsic parameters. • Method: Use image(s) of known scene. • Tools: • Geometric camera models. • SVD and constrained least-squares. • Line extraction methods. CSc 83020 3-D Computer Vision – Ioannis Stamos
Camera Calibration Perspective Equations Feature Extraction From Sebastian Thrun and Jana Kosecka CSc 83020 3-D Computer Vision – Ioannis Stamos
Perspective Projection, Remember? O X x Z f From Sebastian Thrun and Jana Kosecka CSc 83020 3-D Computer Vision – Ioannis Stamos
Intrinsic Camera Parameters • Determine the intrinsic parameters of a camera (with lens) • What are Intrinsic Parameters? (can you name 7?) From Sebastian Thrun and Jana Kosecka CSc 83020 3-D Computer Vision – Ioannis Stamos
Intrinsic Parameters O Image center(ox, oy) X Z f From Sebastian Thrun and Jana Kosecka CSc 83020 3-D Computer Vision – Ioannis Stamos
Intrinsic Camera Parameters • Intrinsic Parameters: • Focal Length f • Pixel size sx ,sy • Image center ox ,oy • (Nonlinear radial distortion coefficients k1 ,k2…) • Calibration = Determine the intrinsic parameters of a camera From Sebastian Thrun and Jana Kosecka CSc 83020 3-D Computer Vision – Ioannis Stamos
Coordinate Frames Camera Coordinate Frame Zc Pixel Coordinates Yc Intrinsic Parameters Xc Extrinsic Parameters Image Coordinate Frame Zw Yw World Coordinate Frame Xw CSc 83020 3-D Computer Vision – Ioannis Stamos
Scene ray Why Calibrate? Image point Image Calibration: relates points in the image to rays in the scene CSc 83020 3-D Computer Vision – Ioannis Stamos
Scene ray Why Calibrate? Image point x y z Image x y Calibration: relates points in the image to rays in the scene CSc 83020 3-D Computer Vision – Ioannis Stamos
Example Calibration Pattern From Sebastian Thrun and Jana Kosecka Calibration Pattern: Object with features of known size/geometry CSc 83020 3-D Computer Vision – Ioannis Stamos
Harris Corner Detector From Sebastian Thrun and Jana Kosecka CSc 83020 3-D Computer Vision – Ioannis Stamos
Perspective Camera r’ r (x,y,z) (X,Y,Z) Center of Projection r =(x,y,z) r’=(X,Y,Z) x=f * X/Z y=f * Y/Z z=f r/f=r’/Z f: effective focal length: distance of image plane from O.
Extrinsic Parameters T Pc=R(Pw-T) Translation followed by rotation
Extrinsic Parameters (2nd formulation) R same as before T different Pc=R Pw +T Rotation followed by translation
The Rotation Matrix T T R * R = R * R = I => R = R Orthonormal Matrix Degrees of freedom? 1 0 0 I= 0 1 0 0 0 1 -1 T CSc 83020 3-D Computer Vision – Ioannis Stamos
Perspective Camera Model • Step 1: Transform into camera coordinates • Step 2: Transform into image coordinates From Sebastian Thrun and Jana Kosecka CSc 83020 3-D Computer Vision – Ioannis Stamos
Intrinsic Parameters CSc 83020 3-D Computer Vision – Ioannis Stamos
Image and Camera Frames Zcamera Ycamera Ximage (xim, yim) Xcamera (ox,oy) Yimage CSc 83020 3-D Computer Vision – Ioannis Stamos
Geometric Model 3D Point in Camera Coordinate Frame XcT x= ZcT YcT y= ZcT • Transformation from Image • to Camera Frame. • (ox,oy,sx,sy) • No distortion! • Transformation from • World to Camera Frame. • Perspective projection • (f, R, T) Point in Camera Frame CSc 83020 3-D Computer Vision – Ioannis Stamos
Camera Calibration: Issues • Which parameters need to be estimated. • Focal length, image center, aspect ratio • Radial distortions • What kind of accuracy is needed. • Application dependent • What kind of calibration object is used. • One plane, many planes • Complicated three dimensional object CSc 83020 3-D Computer Vision – Ioannis Stamos
Camera Calibration Calibration object Extracted features CSc 83020 3-D Computer Vision – Ioannis Stamos
Camera Calibration Extract centers of circles CSc 83020 3-D Computer Vision – Ioannis Stamos
Basic Equations CSc 83020 3-D Computer Vision – Ioannis Stamos
Basic Equations In the remaining slides x means xim and y means yim CSc 83020 3-D Computer Vision – Ioannis Stamos
Basic Equations CSc 83020 3-D Computer Vision – Ioannis Stamos
Basic Equations Extrinsic Parameters 1) Rotation matrix R (3x3) 2) Translation vector T (3x1) • Intrinsic Parameters • fx=f/sx, length in effective horizontal pixel size units. • α=sy/sx, aspect ratio. • (ox,oy), image center coordinates. • Radial distortion coefficients. Total number of parameters (excluding distortion): ? CSc 83020 3-D Computer Vision – Ioannis Stamos
Basic Equations • Assume that image center is known. • Solve for the remaining parameters. • Use N image points and their • corresponding • N world points CSc 83020 3-D Computer Vision – Ioannis Stamos
Basic Equations (1) • Assume that image center is known. • Solve for the remaining parameters. • Use N image points and their • corresponding • N world points Here x means xim - ox and y means yim - oy CSc 83020 3-D Computer Vision – Ioannis Stamos
Basic Equations (2) • Assume that image center is known. • Solve for the remaining parameters. • Use N image points and their • corresponding • N world points CSc 83020 3-D Computer Vision – Ioannis Stamos
Basic Equations (3) CSc 83020 3-D Computer Vision – Ioannis Stamos
Basic Equations (3) How would we solve this system? CSc 83020 3-D Computer Vision – Ioannis Stamos
Basic Equations (3) How would we solve this system? Rank of matrix A? Solution up to a scale factor. CSc 83020 3-D Computer Vision – Ioannis Stamos
Singular Value Decomposition Appendix A.6 (Trucco) A: m x n U: m x m, columns orthogonal unit vectors. V: n x n , -//- D: m x n , diagonal. The diagonal elements σi are the singular values σ1>= σ2>= … >= σn >= 0 CSc 83020 3-D Computer Vision – Ioannis Stamos
Singular Value Decomposition Appendix A.6 (Trucco) • Square A non-singular iff σi != 0 • For square A C=σ1/σN is the condition number • For rectangular A # of non-zero σi is the rank • For square non-singular A: • For square A, pseudoinverse: • Singular values of A = square roots of • eigenvalues of and • 7. Columns of U, V • Eigenvectors of • 8. Frobenius norm of a matrix CSc 83020 3-D Computer Vision – Ioannis Stamos
Singular Value Decomposition Appendix A.6 (Trucco) If rank(A)=n-1 (7 in our case) then the solution is the eigenvector which corresponds to the ONLY zero eigenvalue. Solution up to a scale factor. CSc 83020 3-D Computer Vision – Ioannis Stamos
Solving for v (3) How would we solve this system: SVD. Solution: Uknown scale factor γ=? Aspect ratio α=?
Solving for Tz and fx? CSc 83020 3-D Computer Vision – Ioannis Stamos
Solving for Tz and fx? How would we solve this system? CSc 83020 3-D Computer Vision – Ioannis Stamos
Solving for Tz and fx? How would we solve this system? Solution in the least squares sense. CSc 83020 3-D Computer Vision – Ioannis Stamos
Camera Models (linear versions) 3D Point in World Coordinate Frame x= y= • Transformation from • World to Camera Frame. • Perspective projection • (f, R, T) • Transformation from Image • to Camera Frame. • (ox,oy,sx,sy) • No distortion! Point in Camera Frame CSc 83020 3-D Computer Vision – Ioannis Stamos
Camera Models (linear versions) Elegant decomposition. No distortion! Homogeneous Coordinates Measured Pixel (xim, yim) World Point (Xw, Yw,Zw) ?
Camera Calibration – Other method Extracted features Step 1: Estimate P Step 2: Decompose P into internal and external parameters R,T,C CSc 83020 3-D Computer Vision – Ioannis Stamos
Camera Calibration: Step 1 Extracted features Each point (x,y) gives us two equations
Camera Calibration: Step 1 Extracted features Each corner (x,y) gives us two equations
Camera Calibration: Step 1 2n Extracted features n points gives us 2n equations CSc 83020 3-D Computer Vision – Ioannis Stamos
Camera Calibration: Step 1 2n Extracted features We need to solve In the presence of noise we need to solve The solution is given by the eigenvector with the smallest eigenvalue of CSc 83020 3-D Computer Vision – Ioannis Stamos
Camera Calibration: Step 1 The result can be improved through non-linear minimization. Extracted features CSc 83020 3-D Computer Vision – Ioannis Stamos
Camera Calibration: Step 1 The result can be improved through non-linear minimization. Extracted features Minimize the distance between the predicted and detected features. CSc 83020 3-D Computer Vision – Ioannis Stamos