# 3D Computer Vision and Video Computing 3D Vision Lecture 3 - Part 1 Camera Models CS80000 Section 2 Spring 2005 Professor Zhigang Zhu, Rm 4439

## Presentation on theme: "3D Computer Vision and Video Computing 3D Vision Lecture 3 - Part 1 Camera Models CS80000 Section 2 Spring 2005 Professor Zhigang Zhu, Rm 4439"— Presentation transcript:

3D Computer Vision and Video Computing 3D Vision Lecture 3 - Part 1 Camera Models CS80000 Section 2 Spring 2005 Professor Zhigang Zhu, Rm 4439 http://www-cs.engr.ccny.cuny.edu/~zhu/GC-Spring2005/CSc80000-2-VisionCourse.html

3D Computer Vision and Video Computing 3D Vision n Closely Related Disciplines l Image Processing – images to mages l Computer Graphics – models to images l Computer Vision – images to models l Photogrammetry – obtaining accurate measurements from images n What is 3-D ( three dimensional) Vision? l Motivation: making computers see (the 3D world as humans do) l Computer Vision: 2D images to 3D structure l Applications : robotics / VR /Image-based rendering/ 3D video n Lectures on 3-D Vision Fundamentals l Camera Geometric Models (this lecture and omni cameras) l Camera Calibration (1 lecture) l Stereo (1 lecture) l Motion (1 lecture)

3D Computer Vision and Video Computing Lecture Outline n Geometric Projection of a Camera l Pinhole camera model l Perspective projection l Weak-Perspective Projection n Camera Parameters l Intrinsic Parameters: define mapping from 3D to 2D l Extrinsic parameters: define viewpoint and viewing direction n Basic Vector and Matrix Operations, Rotation n Camera Models Revisited l Linear Version of the Projection Transformation Equation n Perspective Camera Model n Weak-Perspective Camera Model n Affine Camera Model n Camera Model for Planes n Summary

3D Computer Vision and Video Computing Lecture Assumptions n Camera Geometric Models l Knowledge about 2D and 3D geometric transformations l Linear algebra (vector, matrix) l This lecture is only about geometry n Goal Build up relation between 2D images and 3D scenes -3D Graphics (rendering): from 3D to 2D -3D Vision (stereo and motion): from 2D to 3D -Calibration: Determning the parameters for mapping

3D Computer Vision and Video Computing Image Formation

3D Computer Vision and Video Computing Image Formation Light (Energy) Source Surface Pinhole Lens Imaging Plane WorldOpticsSensorSignal Camera: Spec & Pose 3D Scene 2D Image

3D Computer Vision and Video Computing Pinhole Camera Model Pin-hole is the basis for most graphics and vision Derived from physical construction of early cameras Mathematics is very straightforward n 3D World projected to 2D Image l Image inverted, size reduced l Image is a 2D plane: No direct depth information n Perspective projection l f called the focal length of the lens l given image size, change f will change FOV and figure sizes

3D Computer Vision and Video Computing Focal Length, FOV n Consider case with object on the optical axis: f z n Optical axis: the direction of imaging n Image plane: a plane perpendicular to the optical axis n Center of Projection (pinhole), focal point, viewpoint, nodal point n Focal length: distance from focal point to the image plane n FOV : Field of View – viewing angles in horizontal and vertical directions viewpoint Image plane

3D Computer Vision and Video Computing Focal Length, FOV n Consider case with object on the optical axis: f z Out of view Image plane n Optical axis: the direction of imaging n Image plane: a plane perpendicular to the optical axis n Center of Projection (pinhole), focal point, viewpoint,, nodal point n Focal length: distance from focal point to the image plane n FOV : Field of View – viewing angles in horizontal and vertical directions n Increasing f will enlarge figures, but decrease FOV

3D Computer Vision and Video Computing Equivalent Geometry n Consider case with object on the optical axis: f z n More convenient with upright image: n Equivalent mathematically

3D Computer Vision and Video Computing Perspective Projection n Compute the image coordinates of p in terms of the world (camera) coordinates of P. n Origin of camera at center of projection n Z axis along optical axis n Image Plane at Z = f; x // X and y//Y

3D Computer Vision and Video Computing Reverse Projection n Given a center of projection and image coordinates of a point, it is not possible to recover the 3D depth of the point from a single image. In general, at least two images of the same point taken from two different locations are required to recover depth.

3D Computer Vision and Video Computing Pinhole camera image Photo by Robert Kosara, robert@kosara.net http://www.kosara.net/gallery/pinholeamsterdam/pic01.html Amsterdam : what do you see in this picture? l straight line l size l parallelism/angle l shape l shape of planes l depth

3D Computer Vision and Video Computing Pinhole camera image Photo by Robert Kosara, robert@kosara.net http://www.kosara.net/gallery/pinholeamsterdam/pic01.html Amsterdam straight line l size l parallelism/angle l shape l shape of planes l depth

3D Computer Vision and Video Computing Pinhole camera image Photo by Robert Kosara, robert@kosara.net http://www.kosara.net/gallery/pinholeamsterdam/pic01.html Amsterdam straight line  size l parallelism/angle l shape l shape of planes l depth

3D Computer Vision and Video Computing Pinhole camera image Photo by Robert Kosara, robert@kosara.net http://www.kosara.net/gallery/pinholeamsterdam/pic01.html Amsterdam straight line  size  parallelism/angle l shape l shape of planes l depth

3D Computer Vision and Video Computing Pinhole camera image Photo by Robert Kosara, robert@kosara.net http://www.kosara.net/gallery/pinholeamsterdam/pic01.html Amsterdam straight line  size  parallelism/angle  shape l shape of planes l depth

3D Computer Vision and Video Computing Pinhole camera image Photo by Robert Kosara, robert@kosara.net http://www.kosara.net/gallery/pinholeamsterdam/pic01.html Amsterdam straight line  size  parallelism/angle  shape l shape of planes parallel to image l depth

3D Computer Vision and Video Computing Pinhole camera image - We see spatial shapes rather than individual pixels - Knowledge: top-down vision belongs to human - Stereo &Motion most successful in 3D CV & application - You can see it but you don't know how… Amsterdam: what do you see? straight line  size  parallelism/angle  shape l shape of planes parallel to image l Depth ? l stereo l motion l size l structure …

3D Computer Vision and Video Computing Yet other pinhole camera images Markus Raetz, Metamorphose II, 1991-92, cast iron, 15 1/4 x 12 x 12 inches Fine Art Center University Gallery, Sep 15 – Oct 26 Rabbit or Man?

3D Computer Vision and Video Computing Yet other pinhole camera images Markus Raetz, Metamorphose II, 1991-92, cast iron, 15 1/4 x 12 x 12 inches Fine Art Center University Gallery, Sep 15 – Oct 26 2D projections are not the “same” as the real object as we usually see everyday!

3D Computer Vision and Video Computing It’s real!

3D Computer Vision and Video Computing Weak Perspective Projection n Average depth Z is much larger than the relative distance between any two scene points measured along the optical axis n A sequence of two transformations l Orthographic projection : parallel rays l Isotropic scaling : f/Z n Linear Model l Preserve angles and shapes x y Z P(X,Y,Z) p(x, y) Z = f 0 Y X

3D Computer Vision and Video Computing Camera Parameters n Coordinate Systems l Frame coordinates (x im, y im ) pixels l Image coordinates (x,y) in mm l Camera coordinates (X,Y,Z) l World coordinates (X w,Y w,Z w ) n Camera Parameters l Intrinsic Parameters (of the camera and the frame grabber): link the frame coordinates of an image point with its corresponding camera coordinates l Extrinsic parameters: define the location and orientation of the camera coordinate system with respect to the world coordinate system ZwZw XwXw YwYw Y X Z x y O PwPw P p x im y im (x im,y im ) Pose / Camera Object / World Image frame Frame Grabber

3D Computer Vision and Video Computing Intrinsic Parameters (I) n From image to frame l Image center l Directions of axes l Pixel size n From 3D to 2D l Perspective projection n Intrinsic Parameters l (o x,o y ) : image center (in pixels) l (s x,s y ) : effective size of the pixel (in mm) l f: focal length x im y im Pixel (x im,y im ) Y Z X x y O p (x,y,f)oxox oyoy (0,0) Size: (s x,s y )

3D Computer Vision and Video Computing Intrinsic Parameters (II) n Lens Distortions n Modeled as simple radial distortions l r 2 = x d 2 +y d 2 l (x d, y d ) distorted points l k 1, k 2 : distortion coefficients l A model with k 2 =0 is still accurate for a CCD sensor of 500x500 with ~5 pixels distortion on the outer boundary (xd, yd)(x, y) k 1, k 2

3D Computer Vision and Video Computing Extrinsic Parameters n From World to Camera n Extrinsic Parameters l A 3-D translation vector, T, describing the relative locations of the origins of the two coordinate systems (what’s it?) l A 3x3 rotation matrix, R, an orthogonal matrix that brings the corresponding axes of the two systems onto each other ZwZw XwXw YwYw Y X Z x y O PwPw P p x im y im (x im,y im ) T

3D Computer Vision and Video Computing Linear Algebra: Vector and Matrix n A point as a 2D/ 3D vector l Image point: 2D vector l Scene point: 3D vector l Translation: 3D vector n Vector Operations l Addition: n Translation of a 3D vector l Dot product ( a scalar): a.b = |a||b|cos  l Cross product (a vector) n Generates a new vector that is orthogonal to both of them T: Transpose a x b = (a 2 b 3 - a 3 b 2 )i + (a 3 b 1 - a 1 b 3 )j + (a 1 b 2 - a 2 b 1 )k

3D Computer Vision and Video Computing Linear Algebra: Vector and Matrix n Rotation: 3x3 matrix l Orthogonal : n 9 elements => 3+3 constraints (orthogonal) => 2+2 constraints (unit vectors) => 3 DOF ? (degrees of freedom) l How to generate R from three angles? (next few slides) n Matrix Operations l R P w +T= ? - Points in the World are projected on three new axes (of the camera system) and translated to a new origin

3D Computer Vision and Video Computing Rotation: from Angles to Matrix n Rotation around the Axes l Result of three consecutive rotations around the coordinate axes n Notes: l Only three rotations l Every time around one axis l Bring corresponding axes to each other n Xw = X, Yw = Y, Zw = Z l First step (e.g.) Bring Xw to X ZwZw XwXw YwYw Y X Z O   

3D Computer Vision and Video Computing Rotation: from Angles to Matrix Rotation  around the Z w Axis l Rotate in X w OY w plane l Goal: Bring X w to X l But X is not in XwOYw l Y w  X  X in X w OZ w (  Y w  X w OZ w )  Y w in YOZ (  X  YOZ) n Next time rotation around Y w ZwZw XwXw YwYw Y X Z O 

3D Computer Vision and Video Computing Rotation: from Angles to Matrix Rotation  around the Z w Axis l Rotate in X w OY w plane so that l Y w  X  X in X w OZ w (  Y w  X w OZ w )  Y w in YOZ (  X  YOZ) n Z w does not change ZwZw XwXw YwYw Y X Z O 

3D Computer Vision and Video Computing Rotation: from Angles to Matrix Rotation  around the Y w Axis l Rotate in X w OZ w plane so that l X w = X  Z w in YOZ (& Y w in YOZ) n Y w does not change ZwZw XwXw YwYw Y X Z O 

3D Computer Vision and Video Computing Rotation: from Angles to Matrix Rotation  around the Y w Axis l Rotate in X w OZ w plane so that l X w = X  Z w in YOZ (& Y w in YOZ) n Y w does not change ZwZw XwXw YwYw Y X Z O 

3D Computer Vision and Video Computing Rotation: from Angles to Matrix Rotation  around the X w (X) Axis l Rotate in Y w OZ w plane so that l Y w = Y, Z w = Z (& X w = X) n X w does not change ZwZw XwXw YwYw Y X Z O 

3D Computer Vision and Video Computing Rotation: from Angles to Matrix Rotation  around the X w (X) Axis l Rotate in Y w OZ w plane so that l Y w = Y, Z w = Z (& X w = X) n X w does not change ZwZw XwXw YwYw Y X Z O 

3D Computer Vision and Video Computing Rotation: from Angles to Matrix n Rotation around the Axes l Result of three consecutive rotations around the coordinate axes n Notes: l Rotation directions The order of multiplications matters:  Same R, 6 different sets of  R Non-linear function of  l R is orthogonal l It’s easy to compute angles from R ZwZw XwXw YwYw Y X Z O    Appendix A.9 of the textbook

3D Computer Vision and Video Computing Rotation- Axis and Angle According to Euler’s Theorem, any 3D rotation can be described by a rotating angle, , around an axis defined by an unit vector n = [n 1, n 2, n 3 ] T. n Three degrees of freedom – why? Appendix A.9 of the textbook

3D Computer Vision and Video Computing Linear Version of Perspective Projection n World to Camera l Camera: P = (X,Y,Z) T l World: P w = (X w,Y w,Z w ) T l Transform: R, T n Camera to Image l Camera: P = (X,Y,Z) T l Image: p = (x,y) T l Not linear equations n Image to Frame l Neglecting distortion l Frame (x im, y im ) T n World to Frame l (X w,Y w,Z w ) T -> (x im, y im ) T l Effective focal lengths n f x = f/s x, f y =f/s y n Three are not independent

3D Computer Vision and Video Computing Linear Matrix Equation of perspective projection n Projective Space l Add fourth coordinate n P w = (X w,Y w,Z w, 1 ) T l Define (x 1,x 2,x 3 ) T such that n x 1 / x 3 =x im, x 2 / x 3 =y im n 3x4 Matrix M ext l Only extrinsic parameters l World to camera n 3x3 Matrix M int l Only intrinsic parameters l Camera to frame n Simple Matrix Product! Projective Matrix M= M int M ext l (X w,Y w,Z w ) T -> (x im, y im ) T l Linear Transform from projective space to projective plane l M defined up to a scale factor – 11 independent entries

3D Computer Vision and Video Computing Three Camera Models n Perspective Camera Model l Making some assumptions n Known center: Ox = Oy = 0 n Square pixel: Sx = Sy = 1 l 11 independent entries 7 parameters n Weak-Perspective Camera Model Average Distance Z >> Range  Z l Define centroid vector P w l 8 independent entries n Affine Camera Model l Mathematical Generalization of Weak-Pers l Doesn’t correspond to physical camera l But simple equation and appealing geometry n Doesn’t preserve angle BUT parallelism l 8 independent entries

3D Computer Vision and Video Computing Camera Models for a Plane n Planes are very common in the Man-Made World l One more constraint for all points: Zw is a function of Xw and Yw n Special case: Ground Plane l Z w =0 l P w =(X w, Y w,0, 1) T l 3D point -> 2D point n Projective Model of a Plane l 8 independent entries n General Form ? l 8 independent entries

3D Computer Vision and Video Computing Camera Models for a Plane n A Plane in the World l One more constraint for all points: Zw is a function of Xw and Yw n Special case: Ground Plane l Z w =0 l P w =(X w, Y w,0, 1) T l 3D point -> 2D point n Projective Model of Z w =0 l 8 independent entries n General Form ? l 8 independent entries

3D Computer Vision and Video Computing Camera Models for a Plane n A Plane in the World l One more constraint for all points: Zw is a function of Xw and Yw n Special case: Ground Plane l Z w =0 l P w =(X w, Y w,0, 1) T l 3D point -> 2D point n Projective Model of Z w =0 l 8 independent entries n General Form ? l n z = 1 l 8 independent entries n 2D (x im,y im ) -> 3D (X w, Y w, Z w ) ?

3D Computer Vision and Video Computing Applications and Issues n Graphics /Rendering l From 3D world to 2D image n Changing viewpoints and directions n Changing focal length l Fast rendering algorithms n Vision / Reconstruction l From 2D image to 3D model n Inverse problem n Much harder / unsolved l Robust algorithms for matching and parameter estimation l Need to estimate camera parameters first n Calibration l Find intrinsic & extrinsic parameters l Given image-world point pairs l Probably a partially solved problem ? l 11 independent entries 10 parameters: f x, f y, o x, o y, , Tx,Ty,Tz

3D Computer Vision and Video Computing 3D Reconstruction from Images (1) Panoramic texture map (2)panoramic depth map Flower Garden Sequence Vision: Camera Calibration l Motion Estimation l 3D reconstruction

3D Computer Vision and Video Computing Image-based 3Dmodel of the FG sequence

3D Computer Vision and Video Computing Rendering from 3D Model Graphics: Virtual Camera l Synthetic motion l From 3D to 2D image

3D Computer Vision and Video Computing Camera Model Summary n Geometric Projection of a Camera l Pinhole camera model l Perspective projection l Weak-Perspective Projection n Camera Parameters (10 or 11) l Intrinsic Parameters: f, o x,o y, s x,s y,k 1: 4 or 5 independent parameters l Extrinsic parameters: R, T – 6 DOF (degrees of freedom) n Linear Equations of Camera Models (without distortion) l General Projection Transformation Equation : 11 parameters l Perspective Camera Model: 11 parameters l Weak-Perspective Camera Model: 8 parameters l Affine Camera Model: generalization of weak-perspective: 8 l Projective transformation of planes: 8 parameters

3D Computer Vision and Video Computing Next n Determining the value of the extrinsic and intrinsic parameters of a camera Calibration (Ch. 6)

Similar presentations