Geometric Model of Camera

Similar documents
3-Dimensional Viewing

MAN-522: COMPUTER VISION SET-2 Projections and Camera Calibration

3D Geometry and Camera Calibration

2D transformations and homogeneous coordinates

3D Sensing. Translation and Scaling in 3D. Rotation about Arbitrary Axis. Rotation in 3D is about an axis

Camera Model and Calibration

Computer Graphics. Geometric Transformations

Image Warping. Some slides from Steve Seitz

Computer Graphics. Geometric Transformations

Announcements. Equation of Perspective Projection. Image Formation and Cameras

CS 2770: Intro to Computer Vision. Multiple Views. Prof. Adriana Kovashka University of Pittsburgh March 14, 2017

Agenda. Rotations. Camera models. Camera calibration. Homographies

CSE328 Fundamentals of Computer Graphics: Theory, Algorithms, and Applications

1. We ll look at: Types of geometrical transformation. Vector and matrix representations

Modeling Transformations

Image Warping. Some slides from Steve Seitz

Announcements. The equation of projection. Image Formation and Cameras

Perspective Projection Transformation

Camera Model and Calibration. Lecture-12

Image Warping CSE399b, Spring 07 Computer Vision

Image formation - About the course. Grading & Project. Tentative Schedule. Course Content. Students introduction

ECE Digital Image Processing and Introduction to Computer Vision. Outline

What and Why Transformations?

Image Warping : Computational Photography Alexei Efros, CMU, Fall Some slides from Steve Seitz

Geometry of image formation

Image Warping (Szeliski Sec 2.1.2)

Motivation. What we ve seen so far. Demo (Projection Tutorial) Outline. Projections. Foundations of Computer Graphics

CS770/870 Spring 2017 Transformations

Modeling Transformations

Geometry of a single camera. Odilon Redon, Cyclops, 1914

Geometric camera models and calibration

Determining the 2d transformation that brings one image into alignment (registers it) with another. And

Today s class. Geometric objects and transformations. Informationsteknologi. Wednesday, November 7, 2007 Computer Graphics - Class 5 1

Camera Models and Image Formation. Srikumar Ramalingam School of Computing University of Utah

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

Computer Graphics. P04 Transformations. Aleksandra Pizurica Ghent University

To Do. Demo (Projection Tutorial) Motivation. What we ve seen so far. Outline. Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 5: Viewing

Jorge Salvador Marques, geometric camera model

Viewing Transformations I Comp 535

Uses of Transformations. 2D transformations Homogeneous coordinates. Transformations. Transformations. Transformations. Transformations and matrices

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Camera Models and Image Formation. Srikumar Ramalingam School of Computing University of Utah

MEM380 Applied Autonomous Robots Winter Robot Kinematics

CS559: Computer Graphics

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

To Do. Motivation. Demo (Projection Tutorial) What we ve seen so far. Computer Graphics. Summary: The Whole Viewing Pipeline

4. Two Dimensional Transformations

CS F-07 Objects in 2D 1

Image Warping. Computational Photography Derek Hoiem, University of Illinois 09/28/17. Photo by Sean Carroll

CS6670: Computer Vision

[ ] [ ] Orthogonal Transformation of Cartesian Coordinates in 2D & 3D. φ = cos 1 1/ φ = tan 1 [ 2 /1]

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

Image Warping. Many slides from Alyosha Efros + Steve Seitz. Photo by Sean Carroll

Viewing and Projection

Transformations. Examples of transformations: shear. scaling

Geometric Transformations

Two Dimensional Viewing

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

Agenda. Rotations. Camera calibration. Homography. Ransac

3D Viewing and Projec5on. Taking Pictures with a Real Camera. Steps: Graphics does the same thing for rendering an image for 3D geometric objects

Image warping. image filtering: change range of image. image warping: change domain of image g(x) = f(h(x)) h(y)=0.5y+0.5. h([x,y])=[x,y/2] f h

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

521466S Machine Vision Exercise #1 Camera models

Pin Hole Cameras & Warp Functions

Affine and Projective Transformations

3D Computer Vision II. Reminder Projective Geometry, Transformations. Nassir Navab. October 27, 2009

Computer Vision Projective Geometry and Calibration. Pinhole cameras

Image Formation I Chapter 2 (R. Szelisky)

Visual Recognition: Image Formation

Vector Algebra Transformations. Lecture 4

Projections. Let us start with projections in 2D, because there are easier to visualize.

More on Transformations. COS 426, Spring 2019 Princeton University

12.4 The Ellipse. Standard Form of an Ellipse Centered at (0, 0) (0, b) (0, -b) center

Projective Geometry and Camera Models

Modeling Transformations

Computer Vision cmput 428/615

Homogeneous Coordinates

Last Lecture. Edge Detection. Filtering Pyramid

Modeling Transformations

Image Formation I Chapter 1 (Forsyth&Ponce) Cameras

3-D D Euclidean Space - Vectors

CS4670: Computer Vision

How is project #1 going?

Transformations II. Week 2, Wed Jan 17

Announcements. Introduction to Cameras. The Key to Axis Angle Rotation. Axis-Angle Form (review) Axis Angle (4 steps) Mechanics of Axis Angle

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

THE INVERSE GRAPH. Finding the equation of the inverse. What is a function? LESSON

Image Formation I Chapter 1 (Forsyth&Ponce) Cameras

Basic Elements. Geometry is the study of the relationships among objects in an n-dimensional space

Pin Hole Cameras & Warp Functions

What does OpenGL do?

Warping, Morphing and Mosaics

Cameras and Stereo CSE 455. Linda Shapiro

Prof. Feng Liu. Winter /05/2019

Viewing. Reading: Angel Ch.5

Projective Geometry and Camera Models

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

Image Warping, mesh, and triangulation CSE399b, Spring 07 Computer Vision

CS231M Mobile Computer Vision Structure from motion

Section 9.3: Functions and their Graphs

Transcription:

Geometric Model of Camera Dr. Gerhard Roth COMP 42A Winter 25 Version 2

Similar Triangles 2

Geometric Model of Camera Perspective projection P(X,Y,Z) p(,) f X Z f Y Z 3

Parallel lines aren t 4 Figure b David Forsth

Lengths can t be trusted... 5

Coordinate Transformation 2D p p p p p cos sin sin cos ' ' ' P ' '' ' '' T T T p p T T p p p cos sin sin cos ' ' '' Rotation and Translation 6

Homogeneous Coordinates Go one dimensional higher: z z is an arbitrar non-zero scalar, usuall e choose. 3 2 3 3 2 / / 4 3 4 2 4 4 3 2 / / / From homogeneous coordinates to Cartesian coordinates: 7

2D Transformation ith Homogeneous Coordinates 2D coordinate transformation using homogeneous coordinates: T T p p p cos sin sin cos '' cos sin sin cos '' '' p p T T p p 2D coordinate transformation: 8

Homogeneous coordinates (In 2d) To points are equal if and onl if: / = / and / = / =: points at infinit useful for projections and curve draing Homogenize = divide b. Homogenized point eample: = 644 78 7 = / = 644/7 = 378.8 = / = 78/7 = 46.5 9

Wh use homogeneous co-ordinates We require a composition (sequence of) rotations, translations and projections Even the projection is a matri multiplication Each of these can be described b matri operations using homogeneous coordinates Composing them together, appling them one after the other just matri multiplication The final operation, hich takes a 3d point and produces a 2d image is one big matri multiplication

Translations ith homogeneous t t t t t t

Scaling ith homogeneous s s s s s s 2

Rotation ith homogeneous co-ord s cos sin sin cos cos sin sin cos cos sin sin cos 3

3D Rotation about X-Ais Representation in homogeneous co-ordinates

3D Rotation about Y-Ais Representation in homogeneous co-ordinates 5

3D Rotation about Z-Ais Representation in homogeneous co-ordinates 6

3D Rotation Matri Euler Angles Rotate around each coordinate ais: R R Rz R ( ) cos sin sin cos R 2 ( ) cos sin sin cos sin R3( ) sin cos cos Combine the three rotations: R RRRz Can describe an 3d rotation b a sequence of rotations about the three ais So R = RRRz or RRzR or RRRz or RRzR or RzRR or RzRR 7

3d Rotation Matri When ou specif the values for each ais ou musts also specif order of operations Different orders have different angle values Succeeding rotations are about an alread modified set of three ais Remember matri multiplication is not commutative AB is not same as BA A rotation matri has 9 elements but e need onl three numbers to specif a 3d rotation uniquel! 8

3d Rotation Matri - Eamples 9

3D Rotation Rodriguez Rotations also described b ais and angle Rotation ais (2 parameters) and amount of rotation (angle parameter) Can convert beteen Euler Angles and Rodriguez representation 2

Degrees of freedom This is the number of parameters necessar to generate all possible instances of a given geometric object A 2d rotation has one degree of freedom Varing one parameter (angle) ill generate ever possible 2d rotation What are degrees of freedom of a 3d rotation It is a 3 b 3 matri ith nine numbers so is it 9? No, the anser is three (alas!) B varing three parameters e can generate ever possible 3d rotation matri (for ever representation!) Wh is it 3 and not 9? 2

Rotation Matrices Both 2d and 3d rotation matrices have to characteristics The are orthogonal (also called orthonormal) R T R I R T R Their determinant is Matri belo is orthogonal but not a rotation matri because the determinate is not this is a reflection matri 22

Rotation Matrices Ros and columns of a rotation matri are unit vectors Ever ro is orthogonal to ever other ros Their dot product is zero Ever column is orthogonal to ever other column Their dot product is zero These etra constraints mean that the entries in the rotation matri are not independent This reduces the degrees of freedom 23

3d Rotation Matri - Inversions Remember that cos(-t) = cos(t) And that sin(-t) = -sin(t) Also for rotation matrices hich e can see R T R I R T R 24

Homogeneous co-ordinates Transformation transform a point in an n dimensional space to another n dim point Transformations are scale, rotations, translations, etc. You can represent all these b multiplication b one appropriate matri using homogeneous co-ordinates Projection transform a point in an n dimensional space to an m dim point For projection m is normall less than n Perspective projection is a projection (3d to 2d) From the 3d orld to a 2d point in the image You can also represent a projection as matri multiplication ith one appropriate matri and homogeneous co-ordinates 25

Four Coordinate Frames im piel frame Z P Y Yc p im im camera frame optical center Xc Zc image plane frame principal point orld frame X Camera model: p transforma tion matri im P 26

Perspective Projection Z X f Z Y f These are nonlinear. Z Y X f f v u Using homogenous coordinate, e have a linear relation: u / v / 27

World to Camera Coordinate T RX X c T R c c c Z Y X Z Y X Transformation beteen the camera and orld coordinates. Here e rotate, then translate, to go from orld to camera co-ordinates hich is opposite of book, but is simpler and is the a in hich OpenCV routines do it: After R, and T e have converted from orld to camera frame. In the camera frame the z ais is along the optical center. 28

Camera Coordinates to Image Coordinates ( o ) s s im, s : ( o ) s im piel sizes in millimeters per piel (o,o) im im im im / s / s o o Camera co-ordinates, and are in millimetres Image co-ordinates im, im, are in piels Center of projection o, o is in piels Sign change because horizontal and vertical ais of the image and camera frame have opposite directions. 29

Image and Camera frames No e look from the camera outard and image origin is the top left piel (,) Zcamera Xcamera (im, im) (o,o) Ycamera Ximage Yimage 3

Put All Together World to Piel / / / / / / / / 3 2 c c c Z Y X T R o s f o s f Z Y X T R f f o s o s Z Y X f f o s o s v u o s o s Z Y X T R K / 3 im 3 im 2 / From camera to piel Add projection Add Rotation And Translation 3

Perspective Projection Matri Projection is a matri multiplication using homogeneous coordinates f f z f f z In practice: lots of coordinate transformations ( f z, f z ) divide b the third coordinate 2D point (3) = Camera to piel coord. trans. matri (33) Perspective projection matri (34) World to camera coord. trans. matri (44) 3D point (4) 32

Camera Parameters Etrinsic parameters define the location and orientation of the camera reference frame ith respect to a orld reference frame Depend on the eternal orld, so the are etrinsic Intrinsic parameters link piel co-ordinates in the image ith the corresponding coordinates in the camera reference frame An intrinsic characteristic of the camera Image co-ordinates are in piels Camera co-ordinates are in millimetres In formulas that do conversions the units must match! 33

Intrinsic Camera Parameters K f / s f / s o o K is a 33 upper triangular matri, called the Camera Calibration Matri. There are five intrinsic parameters: (a) The piel sizes in and directions s, s in millimeters/piel (b) The focal length f in millimeters (c) The principal point (o,o) in piels, hich is the point here the optic ais intersects the image plane. 34 (d) The units of f/s and f/s are in piels, h is this so?

Camera intrinsic parameters Can rite three of these parameters differentl b letting f/s = f and f/s = f Then intrinsic parameters are o,o,f,f The units of these parameters are piels! In practice piels are square (s = s) so that means f should equal f for most cameras Hoever, ever eplicit camera calibration process (using calibration objects) introduces some small errors These calibration errors make f not eactl equal to f So in OpenCV the intrinsic camera parameters are the four folloing o,o,f,f Hoever f is usuall ver close to f and if this is not the case then there is a problem 35

Etrinsic Parameters and Proj. Matri [R T] defines the etrinsic parameters. The 34 matri M = K[R T] is called the projection matri. It takes 3d points in the orld co-ordinate sstem and maps them to the appropriate image co-ordinates in piels 3 2 im Z Y X M Z Y X T R K p 36

Create a complete projection matri Camera located at T c =[T, T, T z ] t =[,2,3] t Camera aimed along z-ais,, aes parallel to orld aes (R=I) T I I I z I I I z I z I z I zz T c = = 2 R= = T T z 3 S= - -2-3 Camera has focal length f = f = image=6448, assume u =32, v =24 Calculate complete 34 projection matri P P 2 P 3 P 4 P 2 P 22 P 23 P 24 32 24 - = -2 = P 3 P 32 P 33 P 34-3 32-96 24-272 -3 37

Using the projection matri - eample P P 2 P 3 P 4 P 2 P 22 P 23 P 24 P 3 P 32 P 33 P 34 = 32-96 24-272 -3 Where ould the point (2,5,2) project to in the image? Projection matri u v = P P 2 P 3 P 4 P 2 P 22 P 23 P 24 P 3 P 32 P 33 P 34 X Y Z = 32-96 24-272 -3 2 5 2 u v = 644 78 7 u=u / = 644/7 = 378.8 v=v / = 78/7 = 46.5 World point (2,5,2) project to piel With co-ordinates of (379,47) 38

Using the projection matri - eample P P 2 P 3 P 4 P 2 P 22 P 23 P 24 P 3 P 32 P 33 P 34 = 32-96 24-272 -3 Where ould the point (,2,2) project to in the image? Projection matri u v = P P 2 P 3 P 4 P 2 P 22 P 23 P 24 P 3 P 32 P 33 P 34 X Y Z = 32-96 24-272 -3 2 2 u v = 544 44 7 u=u / = 544/7 = 32 v=v / = 48/7 = 24 39

Effect of change in focal length Small f is ide angle, large f is telescopic 4

Orthographic Projection X I m X Y M X Y Z C c Z Y 4

Orthographic Projection X I O 3 C Z O O2 Y 42

Orthographic Projection Special case of perspective projection Distance from center of projection to image plane is infinite Image World Also called parallel projection What s the projection matri? 43 Slide b Steve Seitz

Weak Perspective Model Assume the relative distance beteen an to points in an object along the principal ais is much smaller (/2 th at most) than the Z average distance of the object. Then the camera projection can be approimated as: f X Z f Z X f Y Z f Z Y This is the eak-perspective camera model. Sometimes called scaled orthograph. 44

Weak Perspective Projection To step projection: X I C Z c Z Y plane image plane average depth 45

Weak Perspective 46

Impact of different projections Perspective projections Parallel lines in orld are not parallel in the image Object projection gets smaller ith distance from camera Weak perspective projection Parallel lines in the orld are parallel in the image Object projection gets smaller ith distance from camera Orthographic projection Parallel lines in the orld are parallel in the image Object projection is unchanged ith distance from camera 47

Ordinar Perspective Parallel lines in orld - not parallel in image 48

Weak Perspective Parallel lines in orld parallel in image 49

Image distortion due to optics Radial distortion hich depends on radius r, distance of each point from center of image r 2 = (- o) 2 +(- o) 2 Correction uses three parameters, k,k 2,k 3 5

Radial Distortion Error is proportional to distance of piel from the camera center (the radius of the point) Barrel too far, Pincushion too close 5

Correcting Radial Distortions 52

Tangential Distortion (O, O) center of projection) is not the center of image Also causes a more comple distortion of the image 53

Tangential Distortion Lens not eactl parallel to the image plane Correction uses to parameter p, p 2 Both tpes of distortion are removed (image is un-distorted) and onl then does standard calibration matri K appl to the image Camera calibration computes both K and these five distortion parameters 54

Ho to find the camera parameters K Can use the EXIF tag for an digital image Has focal length f in millimeters but not the piel size But ou can get the piel size from the camera manual There are onl a finite number of different piels sizes because the number of sensing element sizes is limited If there is not a lot of image distortion due to optics then this approach is sufficient (this is onl a linear calibration) Can perform eplicit camera calibration Put a calibration pattern in front of the camera Take a number of different pictures of this pattern No run the calibration algorithm (different tpes) Result is intrinsic camera parameters (linear and non-linear) and the etrinsic camera parameters of all the images 55

Summar Questions Wh do e use homogeneous co-ordinates for image projection? Write the projection equation in a linear form using a matri ith homogeneous co-ordinates. What are the units of image co-ordinates and camera co-ordinates? Ho do ou convert beteen them? Wh do the names etrinsic, and intrinsic parameters of a lens make sense? What are the units of f/s, and f/s? Implications? What are characteristics of perspective, eak perspective and orthographic projection? What are parameters of models for non-linear lens characteristics? 56