Visual Recognition: Image Formation

Similar documents
CS612 - Algorithms in Bioinformatics

CS354 Computer Graphics Rotations and Quaternions

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

CSE 252B: Computer Vision II

Computer Vision I - Appearance-based Matching and Projective Geometry

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

Structure from motion

Autonomous Navigation for Flying Robots

calibrated coordinates Linear transformation pixel coordinates

CS 445 / 645 Introduction to Computer Graphics. Lecture 21 Representing Rotations

Structure from motion

Agenda. Rotations. Camera models. Camera calibration. Homographies

Quaternions & Rotation in 3D Space

Orientation & Quaternions

Quaternions and Rotations

Camera models and calibration

Graphics and Interaction Transformation geometry and homogeneous coordinates

COMP30019 Graphics and Interaction Transformation geometry and homogeneous coordinates

Jorg s Graphics Lecture Notes Coordinate Spaces 1

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

Quaternions and Rotations

Quaternions and Rotations

12.1 Quaternions and Rotations

CALCULATING TRANSFORMATIONS OF KINEMATIC CHAINS USING HOMOGENEOUS COORDINATES

Camera Model and Calibration

Advanced Computer Graphics Transformations. Matthias Teschner

3D Geometry and Camera Calibration

CHAPTER 3. Single-view Geometry. 1. Consequences of Projection

3-D D Euclidean Space - Vectors

Computer Vision. 2. Projective Geometry in 3D. Lars Schmidt-Thieme

Agenda. Rotations. Camera calibration. Homography. Ransac

Computer Vision I - Appearance-based Matching and Projective Geometry

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

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

Transformations: 2D Transforms

Two-view geometry Computer Vision Spring 2018, Lecture 10

Rectification and Distortion Correction

Cameras and Radiometry. Last lecture in a nutshell. Conversion Euclidean -> Homogenous -> Euclidean. Affine Camera Model. Simplified Camera Models

Reminder: Lecture 20: The Eight-Point Algorithm. Essential/Fundamental Matrix. E/F Matrix Summary. Computing F. Computing F from Point Matches

Computer Vision Projective Geometry and Calibration. Pinhole cameras

Animating orientation. CS 448D: Character Animation Prof. Vladlen Koltun Stanford University

BIL Computer Vision Apr 16, 2014

Animation. Keyframe animation. CS4620/5620: Lecture 30. Rigid motion: the simplest deformation. Controlling shape for animation

Structure from Motion CSC 767

Computer Vision cmput 428/615

N-Views (1) Homographies and Projection

Introduction to Homogeneous coordinates

Pin Hole Cameras & Warp Functions

Introduction to Computer Vision

Geometric camera models and calibration

Assignment 2 : Projection and Homography

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

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

METR Robotics Tutorial 2 Week 2: Homogeneous Coordinates

Projective geometry, camera models and calibration

Quaternion Rotations AUI Course Denbigh Starkey

Vector Algebra Transformations. Lecture 4

Lecture Note 3: Rotational Motion

Image warping , , Computational Photography Fall 2017, Lecture 10

COMP 558 lecture 19 Nov. 17, 2010

Multiple View Geometry in Computer Vision

Camera Projection Models We will introduce different camera projection models that relate the location of an image point to the coordinates of the

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

Camera model and multiple view geometry

Animation. CS 4620 Lecture 32. Cornell CS4620 Fall Kavita Bala

Camera Model and Calibration. Lecture-12

Lecture 9: Epipolar Geometry

Flexible Calibration of a Portable Structured Light System through Surface Plane

Agenda. Perspective projection. Rotations. Camera models

Outline. ETN-FPI Training School on Plenoptic Sensing

COS429: COMPUTER VISON CAMERAS AND PROJECTIONS (2 lectures)

Robotics - Projective Geometry and Camera model. Matteo Pirotta

Multiple View Geometry in computer vision

Vectors and the Geometry of Space

Unit 3 Multiple View Geometry

Quaternions and Rotations

Structure from Motion

Structure from motion

METRIC PLANE RECTIFICATION USING SYMMETRIC VANISHING POINTS

Pin Hole Cameras & Warp Functions

3D Modeling using multiple images Exam January 2008

IMAGE-BASED RENDERING AND ANIMATION

Early Fundamentals of Coordinate Changes and Rotation Matrices for 3D Computer Vision

Fundamentals of Computer Animation

Representing the World

CS-9645 Introduction to Computer Vision Techniques Winter 2019

Transformations Week 9, Lecture 18

Visualizing Quaternions

Kinematic Synthesis. October 6, 2015 Mark Plecnik

CMSC 425: Lecture 6 Affine Transformations and Rotations

Vision Review: Image Formation. Course web page:

GEOMETRIC TRANSFORMATIONS AND VIEWING

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

Motivation. Parametric Curves (later Surfaces) Outline. Tangents, Normals, Binormals. Arclength. Advanced Computer Graphics (Fall 2010)

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

Rotation and Orientation: Fundamentals. Perelyaev Sergei VARNA, 2011

Geometric transformations assign a point to a point, so it is a point valued function of points. Geometric transformation may destroy the equation

COMP30019 Graphics and Interaction Three-dimensional transformation geometry and perspective

Transformations. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

2D Image Transforms Computer Vision (Kris Kitani) Carnegie Mellon University

Transcription:

Visual Recognition: Image Formation Raquel Urtasun TTI Chicago Jan 5, 2012 Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 1 / 61

Today s lecture... Fundamentals of image formation You should know about this already...... so we will go fast on it Read about it if you are not familiar This will be almost all the geometry we will see in this class Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 2 / 61

Material Chapter 2 of Rich Szeliski book Available online here Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 3 / 61

How is an image created? The image formation process that produced a particular image depends on lighting conditions scene geometry, surface properties camera optics [Source: R. Szeliski] Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 4 / 61

Geometric primitives and transformations Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 5 / 61

What are we going to see? Basic 2D and 3D primitives: points lines planes How 3D features are projected into 2D features See [Hartley and Zisserman] book for more details Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 6 / 61

2D primitives: 2D points 2D points, e.g., pixel coordinate in an image, can be defined as p = (x, y) R 2 [ ] x p = y 2D points can also be represented using homogeneous coordinates p = ( x, ȳ, w) P 2, with P 2 = R 3 (0, 0, 0), the perspective 2D space. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 7 / 61

2D primitives: 2D points 2D points, e.g., pixel coordinate in an image, can be defined as p = (x, y) R 2 [ ] x p = y 2D points can also be represented using homogeneous coordinates p = ( x, ȳ, w) P 2, with P 2 = R 3 (0, 0, 0), the perspective 2D space. In homogeneous coordinates vectors that differ only by scale are equivalent. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 7 / 61

2D primitives: 2D points 2D points, e.g., pixel coordinate in an image, can be defined as p = (x, y) R 2 [ ] x p = y 2D points can also be represented using homogeneous coordinates p = ( x, ȳ, w) P 2, with P 2 = R 3 (0, 0, 0), the perspective 2D space. In homogeneous coordinates vectors that differ only by scale are equivalent. A homogeneous vector can be converted into an inhomogeneous one by dividing through by the last element p = ( x; ỹ; w) = w(x; y; 1) = w p with p an augmented vector p = (x, y, 1). Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 7 / 61

2D primitives: 2D points 2D points, e.g., pixel coordinate in an image, can be defined as p = (x, y) R 2 [ ] x p = y 2D points can also be represented using homogeneous coordinates p = ( x, ȳ, w) P 2, with P 2 = R 3 (0, 0, 0), the perspective 2D space. In homogeneous coordinates vectors that differ only by scale are equivalent. A homogeneous vector can be converted into an inhomogeneous one by dividing through by the last element p = ( x; ỹ; w) = w(x; y; 1) = w p with p an augmented vector p = (x, y, 1). Homogeneous points whose last element is 0 are called ideal points or points at infinity and do not have an inhomogeneous representation. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 7 / 61

2D primitives: 2D points 2D points, e.g., pixel coordinate in an image, can be defined as p = (x, y) R 2 [ ] x p = y 2D points can also be represented using homogeneous coordinates p = ( x, ȳ, w) P 2, with P 2 = R 3 (0, 0, 0), the perspective 2D space. In homogeneous coordinates vectors that differ only by scale are equivalent. A homogeneous vector can be converted into an inhomogeneous one by dividing through by the last element p = ( x; ỹ; w) = w(x; y; 1) = w p with p an augmented vector p = (x, y, 1). Homogeneous points whose last element is 0 are called ideal points or points at infinity and do not have an inhomogeneous representation. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 7 / 61

2D primitives: 2D lines 2D lines l = (a, b, c) can be represented in homogeneous coordinates p l = ax + by + c = 0 If we normalize such that l = (n x, n y, d) = (n, d) with n = 1, then n is the normal, perpendicular to the line and d is its distance to the origin. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 8 / 61

2D primitives: 2D lines 2D lines l = (a, b, c) can be represented in homogeneous coordinates p l = ax + by + c = 0 If we normalize such that l = (n x, n y, d) = (n, d) with n = 1, then n is the normal, perpendicular to the line and d is its distance to the origin. Exception is the line at infinity, i.e., l = (0, 0, 1), which includes all (ideal) points at infinity. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 8 / 61

2D primitives: 2D lines 2D lines l = (a, b, c) can be represented in homogeneous coordinates p l = ax + by + c = 0 If we normalize such that l = (n x, n y, d) = (n, d) with n = 1, then n is the normal, perpendicular to the line and d is its distance to the origin. Exception is the line at infinity, i.e., l = (0, 0, 1), which includes all (ideal) points at infinity. We can also express in polar coordinates, i.e., l = (d, θ) with n = (cos θ, sin θ). Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 8 / 61

2D primitives: 2D lines 2D lines l = (a, b, c) can be represented in homogeneous coordinates p l = ax + by + c = 0 If we normalize such that l = (n x, n y, d) = (n, d) with n = 1, then n is the normal, perpendicular to the line and d is its distance to the origin. Exception is the line at infinity, i.e., l = (0, 0, 1), which includes all (ideal) points at infinity. We can also express in polar coordinates, i.e., l = (d, θ) with n = (cos θ, sin θ). Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 8 / 61

2D lines and 2D points When using homogeneous coordinates... We can compute the intersection of two lines with the cross product. p = l 1 l 2 The cross product a b is defined as a vector c that is perpendicular to both a and b, with a direction given by the right-hand rule and a magnitude equal to the area of the parallelogram that the vectors span. c = a b sin θ n Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 9 / 61

2D lines and 2D points When using homogeneous coordinates... We can compute the intersection of two lines with the cross product. p = l 1 l 2 The cross product a b is defined as a vector c that is perpendicular to both a and b, with a direction given by the right-hand rule and a magnitude equal to the area of the parallelogram that the vectors span. c = a b sin θ n The line joining two points can be expressed as l = p 1 p 2 Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 9 / 61

2D lines and 2D points When using homogeneous coordinates... We can compute the intersection of two lines with the cross product. p = l 1 l 2 The cross product a b is defined as a vector c that is perpendicular to both a and b, with a direction given by the right-hand rule and a magnitude equal to the area of the parallelogram that the vectors span. c = a b sin θ n The line joining two points can be expressed as l = p 1 p 2 Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 9 / 61

2D primitives: 2D conics 2D conic is a curve obtained by intersecting a cone (i.e., a right circular conical surface) with a plane and can be written using a quadric equation Q expresses the type of quadric. pq p = 0 Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 10 / 61

2D primitives: 2D conics 2D conic is a curve obtained by intersecting a cone (i.e., a right circular conical surface) with a plane and can be written using a quadric equation Q expresses the type of quadric. pq p = 0 Useful to represent human body or basic primitives and in geometry and camera calibration Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 10 / 61

2D primitives: 2D conics 2D conic is a curve obtained by intersecting a cone (i.e., a right circular conical surface) with a plane and can be written using a quadric equation Q expresses the type of quadric. pq p = 0 Useful to represent human body or basic primitives and in geometry and camera calibration Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 10 / 61

3D primitives: 3D points Point coordinates in 3D can be written using inhomogeneous coordinates p = (x, y, z) R 3. And also in homogeneous coordinates p = ( x, ỹ, z, w) P 3. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 11 / 61

3D primitives: 3D points Point coordinates in 3D can be written using inhomogeneous coordinates p = (x, y, z) R 3. And also in homogeneous coordinates p = ( x, ỹ, z, w) P 3. It is useful to denote a 3D point using the augmented vector p = (x, y, z, 1) with p = w x. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 11 / 61

3D primitives: 3D points Point coordinates in 3D can be written using inhomogeneous coordinates p = (x, y, z) R 3. And also in homogeneous coordinates p = ( x, ỹ, z, w) P 3. It is useful to denote a 3D point using the augmented vector p = (x, y, z, 1) with p = w x. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 11 / 61

3D primitives: 3D plane In homogeneous coordinates, m = (a, b, c, d), the plane is p m = ax + by + cz + d = 0 If we normalize such that m = (n x, n y, n z, d) = (n, d) with n = 1, then n is the normal, perpendicular to the plane, and d is its distance to the origin. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 12 / 61

3D primitives: 3D plane In homogeneous coordinates, m = (a, b, c, d), the plane is p m = ax + by + cz + d = 0 If we normalize such that m = (n x, n y, n z, d) = (n, d) with n = 1, then n is the normal, perpendicular to the plane, and d is its distance to the origin. The plane at infinity m = (0, 0, 0, 1), containing all the points at infinity, cannot be normalized. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 12 / 61

3D primitives: 3D plane In homogeneous coordinates, m = (a, b, c, d), the plane is p m = ax + by + cz + d = 0 If we normalize such that m = (n x, n y, n z, d) = (n, d) with n = 1, then n is the normal, perpendicular to the plane, and d is its distance to the origin. The plane at infinity m = (0, 0, 0, 1), containing all the points at infinity, cannot be normalized. We can express in spherical coordinates n = (cos θ, cos φ, sin θ cos φ, sin φ) Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 12 / 61

3D primitives: 3D plane In homogeneous coordinates, m = (a, b, c, d), the plane is p m = ax + by + cz + d = 0 If we normalize such that m = (n x, n y, n z, d) = (n, d) with n = 1, then n is the normal, perpendicular to the plane, and d is its distance to the origin. The plane at infinity m = (0, 0, 0, 1), containing all the points at infinity, cannot be normalized. We can express in spherical coordinates n = (cos θ, cos φ, sin θ cos φ, sin φ) Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 12 / 61

3D primitives: 3D line One possible representation is to use two points on the line, (p, q), then any point can be expressed as a linear combination of these two points r = (1 λ)p + λq If 0 λ 1, then we get the line segment joining p and q. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 13 / 61

3D primitives: 3D line One possible representation is to use two points on the line, (p, q), then any point can be expressed as a linear combination of these two points r = (1 λ)p + λq If 0 λ 1, then we get the line segment joining p and q. In homogeneous coordinates, r = µ p + λ q Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 13 / 61

3D primitives: 3D line One possible representation is to use two points on the line, (p, q), then any point can be expressed as a linear combination of these two points r = (1 λ)p + λq If 0 λ 1, then we get the line segment joining p and q. In homogeneous coordinates, r = µ p + λ q When a point is at infinity, i.e., q = (d x, d y, d z, 0) = (d, 0), then r = p + λd Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 13 / 61

3D primitives: 3D line One possible representation is to use two points on the line, (p, q), then any point can be expressed as a linear combination of these two points r = (1 λ)p + λq If 0 λ 1, then we get the line segment joining p and q. In homogeneous coordinates, r = µ p + λ q When a point is at infinity, i.e., q = (d x, d y, d z, 0) = (d, 0), then r = p + λd Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 13 / 61

3D primitives: 3D conics Can be written using a quadric equation pq p = 0 Q expresses the type of quadric. Useful to represent human body in 3D or basic primitives Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 14 / 61

2D Transformations Translation: can be written as p = p + t, or p = [ I t ] p with I the 2 2 identity matrix, or [ I t p = 0 T 1 where 0 is the zero vector Which representation is more useful? Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 15 / 61 ] p

2D Transformations Translation: can be written as p = p + t, or p = [ I t ] p with I the 2 2 identity matrix, or [ I t p = 0 T 1 where 0 is the zero vector Which representation is more useful? Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 15 / 61 ] p

2D Transformations 2D Rigid Body Motion: can be written as p = Rp + t, or p = [ R t ] p with [ ] cos θ sin θ R = sin θ cos θ is an orthonormal rotation matrix RR T = I, and R = 1 Can also be written in homogeneous coordinates. Also called 2D Euclidean transformation Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 16 / 61

2D Transformations Similarity transform: is p = srp + t, with s an scale factor. Also written as p = [ sr t ] [ a b tx p = b a t y where we no longer require that a 2 + b 2 = 1. Preserves angles between lines. ] p Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 17 / 61

2D Transformations Affine is p = A p, with A an arbitrary 2 3 matrix, i.e., [ ] p a00 a = 01 a 02 p a 10 a 11 a 12 Parallel lines remain parallel under affine transformations. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 18 / 61

2D Transformations Projective operates on homogeneous coordinates with H an arbitrary 3 3 matrix. p = H p Also known as perspective transform or homography. H is homogeneous, i.e., it is only defined up to a scale. Two H matrices that differ only by scale are equivalent. Perspective transformations preserve straight lines. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 19 / 61

Hierarchy of Transformations A set of (potentially restricted) 3 3 matrices operating on 2D homogeneous coordinate vectors. They form a nested set of groups, i.e., they are closed under composition and have an inverse that is a member of the same group. Each (simpler) group is a subset of the more complex group below it. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 20 / 61

Hierarchy of 2D Transformations They can be applied in series Other transformations exist, e.g., stretch/squash Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 21 / 61

Hierarchy of 3D Transformations Same as the 2D hierarchy. Check the book chapter for the exact definition. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 22 / 61

Representing Rotations Representing 2D rotations in Euler angles is not a problem. However, it is a problem in 3D. Alternative representations: axis angles, quaternions. Let s see some of this representations. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 23 / 61

Euler angles: definition The most popular parameterization of orientation space. A general rotation is described as a sequence of rotations about three mutually orthogonal coordinate axes fixed in the space. The rotations are applied to the space and not to the axis. Figure: Principal rotation matrices: Rotation along the x-axis. Watt 95] [Souce: Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 24 / 61

Euler angles: definition The most popular parameterization of orientation space. A general rotation is described as a sequence of rotations about three mutually orthogonal coordinate axes fixed in the space. The rotations are applied to the space and not to the axis. Figure: Principal rotation matrices: Rotation along the y-axis. [Souce: Watt 95] Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 24 / 61

Euler angles: definition The most popular parameterization of orientation space. A general rotation is described as a sequence of rotations about three mutually orthogonal coordinate axes fixed in the space. The rotations are applied to the space and not to the axis. Figure: Principal rotation matrices: Watt 95] Rotation along the z-axis. [Souce: Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 24 / 61

Euler angles: composition General rotations can be done by composing rotations over these axis. For example, let s create a rotation matrix R(θ x, θ y, θ z ) in terms of the joint angles θ x, θ y, θ z. c y c z c y s z s y 0 R(θ x, θ y, θ z ) = R x R y R z = s x s y c z c x s z s x s y s z + c x c z s x c y 0 c x s y c z + s x s z c x s y s z s x c z c x c y 0 0 0 0 1 with s i = sin(θ i ), and c i = cos(θ i ). Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 25 / 61

Euler angles: composition General rotations can be done by composing rotations over these axis. For example, let s create a rotation matrix R(θ x, θ y, θ z ) in terms of the joint angles θ x, θ y, θ z. c y c z c y s z s y 0 R(θ x, θ y, θ z ) = R x R y R z = s x s y c z c x s z s x s y s z + c x c z s x c y 0 c x s y c z + s x s z c x s y s z s x c z c x c y 0 0 0 0 1 with s i = sin(θ i ), and c i = cos(θ i ). Matrix multiplication is not conmutative, the order is important R x R y R z R z R y R x Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 25 / 61

Euler angles: composition General rotations can be done by composing rotations over these axis. For example, let s create a rotation matrix R(θ x, θ y, θ z ) in terms of the joint angles θ x, θ y, θ z. c y c z c y s z s y 0 R(θ x, θ y, θ z ) = R x R y R z = s x s y c z c x s z s x s y s z + c x c z s x c y 0 c x s y c z + s x s z c x s y s z s x c z c x c y 0 0 0 0 1 with s i = sin(θ i ), and c i = cos(θ i ). Matrix multiplication is not conmutative, the order is important R x R y R z R z R y R x Rotations are assumed to be relative to fixed world axes, rather than local to the object. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 25 / 61

Euler angles: composition General rotations can be done by composing rotations over these axis. For example, let s create a rotation matrix R(θ x, θ y, θ z ) in terms of the joint angles θ x, θ y, θ z. c y c z c y s z s y 0 R(θ x, θ y, θ z ) = R x R y R z = s x s y c z c x s z s x s y s z + c x c z s x c y 0 c x s y c z + s x s z c x s y s z s x c z c x c y 0 0 0 0 1 with s i = sin(θ i ), and c i = cos(θ i ). Matrix multiplication is not conmutative, the order is important R x R y R z R z R y R x Rotations are assumed to be relative to fixed world axes, rather than local to the object. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 25 / 61

Euler angles: drawbacks I Gimbal lock: This results when two axes effectively line up, resulting in a temporary loss of a degree of freedom. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 26 / 61

Euler angles: drawbacks I Gimbal lock: This results when two axes effectively line up, resulting in a temporary loss of a degree of freedom. This is a singularity in the parameterization. θ 1 and θ 3 become associated with the same DOF. 0 0 1 0 R(θ 1, π 2, θ 3) = sin(θ 1 θ 3 ) cos(θ 1 θ 3 ) 0 0 cos(θ 1 θ 3 ) sin(θ 1 θ 3 ) 0 0 0 0 0 1 Figure: Singular locations of the Euler angles parametrization (at β = ±π/2) Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 26 / 61

Euler angles: drawbacks II The parameterization is non-linear. The parameterization is modular R(θ) = R(θ + 2πn), with n Z. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 27 / 61

Euler angles: drawbacks II The parameterization is non-linear. The parameterization is modular R(θ) = R(θ + 2πn), with n Z. The parameterization is not unique [θ 4, θ 5, θ 6 ] such that R(θ 1, θ 2, θ 3 ) = R(θ 4, θ 5, θ 6 ) with θ i θ 3+i for all i {1, 2, 3}. Figure: Example of two routes for the animation of the block letter R [Watt] Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 27 / 61

Euler angles: drawbacks II The parameterization is non-linear. The parameterization is modular R(θ) = R(θ + 2πn), with n Z. The parameterization is not unique [θ 4, θ 5, θ 6 ] such that R(θ 1, θ 2, θ 3 ) = R(θ 4, θ 5, θ 6 ) with θ i θ 3+i for all i {1, 2, 3}. Figure: Example of two routes for the animation of the block letter R [Watt] Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 27 / 61

Axis Angles A rotation can be represented by a rotation axis n, and an angle θ. Or equivalently by a 3D vector w = θn. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 28 / 61

Axis Angles A rotation can be represented by a rotation axis n, and an angle θ. Or equivalently by a 3D vector w = θn. It s a minimal representation. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 28 / 61

Axis Angles A rotation can be represented by a rotation axis n, and an angle θ. Or equivalently by a 3D vector w = θn. It s a minimal representation. It has a singularity... when does it happen? Figure: Rotation around an axis n by an angle θ Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 28 / 61

Axis Angles A rotation can be represented by a rotation axis n, and an angle θ. Or equivalently by a 3D vector w = θn. It s a minimal representation. It has a singularity... when does it happen? Figure: Rotation around an axis n by an angle θ Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 28 / 61

Quaternions Quaternions were invented by W.R.Hamilton in 1843. A quaternion has 4 components q = [q w, q x, q y, q z ] T Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 29 / 61

Quaternions Quaternions were invented by W.R.Hamilton in 1843. A quaternion has 4 components q = [q w, q x, q y, q z ] T They are extensions of complex numbers a + ib to a 3D imaginary space, ijk. q = q w + q x i + q y j + q z k Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 29 / 61

Quaternions Quaternions were invented by W.R.Hamilton in 1843. A quaternion has 4 components q = [q w, q x, q y, q z ] T They are extensions of complex numbers a + ib to a 3D imaginary space, ijk. q = q w + q x i + q y j + q z k With the additional properties i 2 = j 2 = ijk = 1 i = jk = kj, j = ki = ik, k = ij = ji Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 29 / 61

Quaternions Quaternions were invented by W.R.Hamilton in 1843. A quaternion has 4 components q = [q w, q x, q y, q z ] T They are extensions of complex numbers a + ib to a 3D imaginary space, ijk. q = q w + q x i + q y j + q z k With the additional properties i 2 = j 2 = ijk = 1 i = jk = kj, j = ki = ik, k = ij = ji To represent rotations, only unit length quaternions are used q 2 = qw 2 + qx 2 + qy 2 + qz 2 Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 29 / 61

Quaternions Quaternions were invented by W.R.Hamilton in 1843. A quaternion has 4 components q = [q w, q x, q y, q z ] T They are extensions of complex numbers a + ib to a 3D imaginary space, ijk. q = q w + q x i + q y j + q z k With the additional properties i 2 = j 2 = ijk = 1 i = jk = kj, j = ki = ik, k = ij = ji To represent rotations, only unit length quaternions are used q 2 = qw 2 + qx 2 + qy 2 + qz 2 Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 29 / 61

Quaternions Quaternions were invented by W.R.Hamilton in 1843. A quaternion has 4 components q = [q w, q x, q y, q z ] T They are extensions of complex numbers a + ib to a 3D imaginary space, ijk. q = q w + q x i + q y j + q z k With the additional properties i 2 = j 2 = ijk = 1 i = jk = kj, j = ki = ik, k = ij = ji To represent rotations, only unit length quaternions are used q 2 = qw 2 + qx 2 + qy 2 + qz 2 Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 29 / 61

Quaternions Figure: Unit quaternions live on the unit sphere q = 1. Smooth trajectory through 3 quaternions. The antipodal point to q 2, namely q 2, represents the same rotation. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 30 / 61

Quaternions Quaternions form a group whose underlying set is the four dimensional vector space R 4, with a multiplication operator that combines both the dot product and cross product of vectors. The identity rotation is encoded as q = [1, 0, 0, 0] T. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 31 / 61

Quaternions Quaternions form a group whose underlying set is the four dimensional vector space R 4, with a multiplication operator that combines both the dot product and cross product of vectors. The identity rotation is encoded as q = [1, 0, 0, 0] T. The quaternion q = [q w, q x, q y, q z ] T encodes a rotation of θ = 2 cos 1 (q w ) along the unit axis ˆv = [qx, qy, qz]. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 31 / 61

Quaternions Quaternions form a group whose underlying set is the four dimensional vector space R 4, with a multiplication operator that combines both the dot product and cross product of vectors. The identity rotation is encoded as q = [1, 0, 0, 0] T. The quaternion q = [q w, q x, q y, q z ] T encodes a rotation of θ = 2 cos 1 (q w ) along the unit axis ˆv = [qx, qy, qz]. Also a quaternion can represent a rotation by an angle θ around the ˆv axis as with ˆv = v v. q = [cos θ 2, sin θ 2 ˆv] Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 31 / 61

Quaternions Quaternions form a group whose underlying set is the four dimensional vector space R 4, with a multiplication operator that combines both the dot product and cross product of vectors. The identity rotation is encoded as q = [1, 0, 0, 0] T. The quaternion q = [q w, q x, q y, q z ] T encodes a rotation of θ = 2 cos 1 (q w ) along the unit axis ˆv = [qx, qy, qz]. Also a quaternion can represent a rotation by an angle θ around the ˆv axis as with ˆv = v v. If ˆv is unit length, then q will also be. q = [cos θ 2, sin θ 2 ˆv] Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 31 / 61

Quaternions Quaternions form a group whose underlying set is the four dimensional vector space R 4, with a multiplication operator that combines both the dot product and cross product of vectors. The identity rotation is encoded as q = [1, 0, 0, 0] T. The quaternion q = [q w, q x, q y, q z ] T encodes a rotation of θ = 2 cos 1 (q w ) along the unit axis ˆv = [qx, qy, qz]. Also a quaternion can represent a rotation by an angle θ around the ˆv axis as with ˆv = v v. If ˆv is unit length, then q will also be. Proof: simple exercise. q = [cos θ 2, sin θ 2 ˆv] Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 31 / 61

Quaternions Quaternions form a group whose underlying set is the four dimensional vector space R 4, with a multiplication operator that combines both the dot product and cross product of vectors. The identity rotation is encoded as q = [1, 0, 0, 0] T. The quaternion q = [q w, q x, q y, q z ] T encodes a rotation of θ = 2 cos 1 (q w ) along the unit axis ˆv = [qx, qy, qz]. Also a quaternion can represent a rotation by an angle θ around the ˆv axis as with ˆv = v v. If ˆv is unit length, then q will also be. Proof: simple exercise. q = [cos θ 2, sin θ 2 ˆv] Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 31 / 61

Quaternion to rotational matrix To convert a quaternion q = [q w, q x, q y, q z ] to a rotational matrix simply compute 1 2q 2 y 2q 2 z 2q x q y + 2q w q z 2q x q z 2q w q y 0 2q x q y 2q w q z 1 2q 2 x 2q 2 z 2q y q z + 2q w q x 0 2q x q z + 2q w q y 2q y q z 2q w q x 1 2q 2 x 2q 2 y 0 0 0 0 1 A matrix can also easily be converted to quaternion. See references for the exact algorithm. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 32 / 61

Interpretation of quaternions Any incremental movement along one of the orthogonal axes in curved space corresponds to an incremental rotation along an axis in real space (distances along the hypersphere correspond to angles in 3D space). Moving in some arbitrary direction corresponds to rotating around some arbitrary axis. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 33 / 61

Interpretation of quaternions Any incremental movement along one of the orthogonal axes in curved space corresponds to an incremental rotation along an axis in real space (distances along the hypersphere correspond to angles in 3D space). Moving in some arbitrary direction corresponds to rotating around some arbitrary axis. If you move too far in one direction, you come back to where you started (corresponding to rotating 360 degrees around any one axis). Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 33 / 61

Interpretation of quaternions Any incremental movement along one of the orthogonal axes in curved space corresponds to an incremental rotation along an axis in real space (distances along the hypersphere correspond to angles in 3D space). Moving in some arbitrary direction corresponds to rotating around some arbitrary axis. If you move too far in one direction, you come back to where you started (corresponding to rotating 360 degrees around any one axis). A distance of x along the surface of the hypersphere corresponds to a rotation of angle 2x radians. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 33 / 61

Interpretation of quaternions Any incremental movement along one of the orthogonal axes in curved space corresponds to an incremental rotation along an axis in real space (distances along the hypersphere correspond to angles in 3D space). Moving in some arbitrary direction corresponds to rotating around some arbitrary axis. If you move too far in one direction, you come back to where you started (corresponding to rotating 360 degrees around any one axis). A distance of x along the surface of the hypersphere corresponds to a rotation of angle 2x radians. This means that moving along a 90 degree arc on the hypersphere corresponds to rotating an object by 180 degrees. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 33 / 61

Interpretation of quaternions Any incremental movement along one of the orthogonal axes in curved space corresponds to an incremental rotation along an axis in real space (distances along the hypersphere correspond to angles in 3D space). Moving in some arbitrary direction corresponds to rotating around some arbitrary axis. If you move too far in one direction, you come back to where you started (corresponding to rotating 360 degrees around any one axis). A distance of x along the surface of the hypersphere corresponds to a rotation of angle 2x radians. This means that moving along a 90 degree arc on the hypersphere corresponds to rotating an object by 180 degrees. Traveling 180 degrees corresponds to a 360 degree rotation, thus getting you back to where you started. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 33 / 61

Interpretation of quaternions Any incremental movement along one of the orthogonal axes in curved space corresponds to an incremental rotation along an axis in real space (distances along the hypersphere correspond to angles in 3D space). Moving in some arbitrary direction corresponds to rotating around some arbitrary axis. If you move too far in one direction, you come back to where you started (corresponding to rotating 360 degrees around any one axis). A distance of x along the surface of the hypersphere corresponds to a rotation of angle 2x radians. This means that moving along a 90 degree arc on the hypersphere corresponds to rotating an object by 180 degrees. Traveling 180 degrees corresponds to a 360 degree rotation, thus getting you back to where you started. This implies that q and -q correspond to the same orientation. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 33 / 61

Interpretation of quaternions Any incremental movement along one of the orthogonal axes in curved space corresponds to an incremental rotation along an axis in real space (distances along the hypersphere correspond to angles in 3D space). Moving in some arbitrary direction corresponds to rotating around some arbitrary axis. If you move too far in one direction, you come back to where you started (corresponding to rotating 360 degrees around any one axis). A distance of x along the surface of the hypersphere corresponds to a rotation of angle 2x radians. This means that moving along a 90 degree arc on the hypersphere corresponds to rotating an object by 180 degrees. Traveling 180 degrees corresponds to a 360 degree rotation, thus getting you back to where you started. This implies that q and -q correspond to the same orientation. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 33 / 61

Quaternion operations: dot product The dot product of quaternions is simple their vector dot product p q = p w q w + p x q x + p y q y + p z q z = p q cos φ The angle between two quaternions in 4D space is half the angle one would need to rotate from one orientation to the other in 3D space. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 34 / 61

Quaternion operations: multiplication Multiplication on quaternions can be done by expanding them into complex numbers pq =< s t v w T, sw + tv + v w > where p = [s, v] T, and q = [t, w]. If p represents a rotation and q represents a rotation, then pq represents p rotated by q. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 35 / 61

Quaternion operations: multiplication Multiplication on quaternions can be done by expanding them into complex numbers pq =< s t v w T, sw + tv + v w > where p = [s, v] T, and q = [t, w]. If p represents a rotation and q represents a rotation, then pq represents p rotated by q. Note that two unit quaternions multiplied together will result in another unit quaternion. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 35 / 61

Quaternion operations: multiplication Multiplication on quaternions can be done by expanding them into complex numbers pq =< s t v w T, sw + tv + v w > where p = [s, v] T, and q = [t, w]. If p represents a rotation and q represents a rotation, then pq represents p rotated by q. Note that two unit quaternions multiplied together will result in another unit quaternion. Quaternions extend the planar rotations of complex numbers to 3D rotations in space. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 35 / 61

Quaternion operations: multiplication Multiplication on quaternions can be done by expanding them into complex numbers pq =< s t v w T, sw + tv + v w > where p = [s, v] T, and q = [t, w]. If p represents a rotation and q represents a rotation, then pq represents p rotated by q. Note that two unit quaternions multiplied together will result in another unit quaternion. Quaternions extend the planar rotations of complex numbers to 3D rotations in space. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 35 / 61

Quaternion operations: others Inverse of a quaternion q = [s, v] T q 1 = 1 [s, v]t q 2 Any multiple of a quaternion gives the same rotation because the effects of the magnitude are divided out. Very good for interpolation, Slerp. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 36 / 61

Redundancy of the parameterizations The parameterizations that we have seen: Rotational matrix: 9 DOF. It has 6 extra DOF. Axis angles: 3 DOF for the scaled version and 4 DOF for the non-scaled. The latter has one extra DOF. Quaternions: 4 DOF, 1 extra DOF. From the Euler theorem we know that an arbitrary rotation can be described with only 3 DOF, so those parameters extra are redundant. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 37 / 61

Redundancy of the parameterizations The parameterizations that we have seen: Rotational matrix: 9 DOF. It has 6 extra DOF. Axis angles: 3 DOF for the scaled version and 4 DOF for the non-scaled. The latter has one extra DOF. Quaternions: 4 DOF, 1 extra DOF. From the Euler theorem we know that an arbitrary rotation can be described with only 3 DOF, so those parameters extra are redundant. For rotational matrix, we can impose additional constraints if the matrix represent a rigid transform. a = b = c = 1 a = b c, b = c a, c = a b Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 37 / 61

Redundancy of the parameterizations The parameterizations that we have seen: Rotational matrix: 9 DOF. It has 6 extra DOF. Axis angles: 3 DOF for the scaled version and 4 DOF for the non-scaled. The latter has one extra DOF. Quaternions: 4 DOF, 1 extra DOF. From the Euler theorem we know that an arbitrary rotation can be described with only 3 DOF, so those parameters extra are redundant. For rotational matrix, we can impose additional constraints if the matrix represent a rigid transform. a = b = c = 1 a = b c, b = c a, c = a b Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 37 / 61

Which rotation representation is better? The axis/angle representation is minimal, and hence does not require any additional constraints. If the angle is expressed in degrees, it is easier to understand the pose, and easier to express exact rotations and derivatives are easy to compute. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 38 / 61

Which rotation representation is better? The axis/angle representation is minimal, and hence does not require any additional constraints. If the angle is expressed in degrees, it is easier to understand the pose, and easier to express exact rotations and derivatives are easy to compute. Quaternions do not have discontinuities. It is also easier to interpolate between rotations and to chain rigid transformations. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 38 / 61

Which rotation representation is better? The axis/angle representation is minimal, and hence does not require any additional constraints. If the angle is expressed in degrees, it is easier to understand the pose, and easier to express exact rotations and derivatives are easy to compute. Quaternions do not have discontinuities. It is also easier to interpolate between rotations and to chain rigid transformations. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 38 / 61

3D to 2D projections How are 3D primitives projected onto the image plane? We can do this using a linear 3D to 2D projection matrix Different types. The most commonly used: Orthography Perspective Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 39 / 61

Orthographic Projection An orthographic projection simply drops the z component of p = (x, y, z) to obtain the 2D point q q = [ I 0 ] p Using homogeneous coordinates q = 1 0 0 0 0 1 0 0 0 0 0 1 p Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 40 / 61

Orthographic Projection An orthographic projection simply drops the z component of p = (x, y, z) to obtain the 2D point q q = [ I 0 ] p Using homogeneous coordinates q = 1 0 0 0 0 1 0 0 0 0 0 1 p Is an approximate model for long focal length lenses and objects whose depth is shallow relative to their distance to the camera. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 40 / 61

Orthographic Projection An orthographic projection simply drops the z component of p = (x, y, z) to obtain the 2D point q q = [ I 0 ] p Using homogeneous coordinates q = 1 0 0 0 0 1 0 0 0 0 0 1 p Is an approximate model for long focal length lenses and objects whose depth is shallow relative to their distance to the camera. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 40 / 61

Orthographic Projection Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 41 / 61

Scaled Orthographic Projection Scaled orthography is actually more commonly used to fit to the image q = [ si 0 ] p This model is equivalent to first projecting the world points onto a local fronto-parallel image plane and then scaling this image using regular perspective projection. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 42 / 61

Scaled Orthographic Projection Scaled orthography is actually more commonly used to fit to the image q = [ si 0 ] p This model is equivalent to first projecting the world points onto a local fronto-parallel image plane and then scaling this image using regular perspective projection. The scaling can be the same for all parts of the scene or it can be different for objects that are being modeled independently. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 42 / 61

Scaled Orthographic Projection Scaled orthography is actually more commonly used to fit to the image q = [ si 0 ] p This model is equivalent to first projecting the world points onto a local fronto-parallel image plane and then scaling this image using regular perspective projection. The scaling can be the same for all parts of the scene or it can be different for objects that are being modeled independently. It is a popular model for reconstructing the 3D shape of objects far away from the camera, Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 42 / 61

Scaled Orthographic Projection Scaled orthography is actually more commonly used to fit to the image q = [ si 0 ] p This model is equivalent to first projecting the world points onto a local fronto-parallel image plane and then scaling this image using regular perspective projection. The scaling can be the same for all parts of the scene or it can be different for objects that are being modeled independently. It is a popular model for reconstructing the 3D shape of objects far away from the camera, Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 42 / 61

Scaled Orthographic Projection Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 43 / 61

Perspective Projection Points are projected onto the image plane by dividing them by their z coordinate, i.e., x/z q = P z (p) = y/z 1 In homogeneous coordinates, the projection has a simple linear form, 1 0 0 0 q = 0 1 0 0 p 0 0 1 0 Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 44 / 61

Perspective Projection Points are projected onto the image plane by dividing them by their z coordinate, i.e., x/z q = P z (p) = y/z 1 In homogeneous coordinates, the projection has a simple linear form, 1 0 0 0 q = 0 1 0 0 p 0 0 1 0 We have dropped the w component, thus it is not possible to recover the distance of the 3D point from the image. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 44 / 61

Perspective Projection Points are projected onto the image plane by dividing them by their z coordinate, i.e., x/z q = P z (p) = y/z 1 In homogeneous coordinates, the projection has a simple linear form, 1 0 0 0 q = 0 1 0 0 p 0 0 1 0 We have dropped the w component, thus it is not possible to recover the distance of the 3D point from the image. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 44 / 61

Perspective Projection Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 45 / 61

Perspective Projection [Source: S. Seitz] Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 46 / 61

Camera Intrinsics Once we projected the 3D point through an ideal pinhole using a projection matrix, we must still transform the result according to the pixel sensor spacing and the relative position of the sensor plane to the origin. Image sensors return pixel values indexed by integer pixel coord (x s, y s ). Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 47 / 61

Camera Intrinsics Once we projected the 3D point through an ideal pinhole using a projection matrix, we must still transform the result according to the pixel sensor spacing and the relative position of the sensor plane to the origin. Image sensors return pixel values indexed by integer pixel coord (x s, y s ). To map pixels to 3D coordinates, we first scale the (x s, y s ) by the pixel spacings (s x, s y ). Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 47 / 61

Camera Intrinsics Once we projected the 3D point through an ideal pinhole using a projection matrix, we must still transform the result according to the pixel sensor spacing and the relative position of the sensor plane to the origin. Image sensors return pixel values indexed by integer pixel coord (x s, y s ). To map pixels to 3D coordinates, we first scale the (x s, y s ) by the pixel spacings (s x, s y ). We then describe the orientation of the sensor relative to the camera projection center O c with an origin c s and a 3D rotation R s. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 47 / 61

Camera Intrinsics Once we projected the 3D point through an ideal pinhole using a projection matrix, we must still transform the result according to the pixel sensor spacing and the relative position of the sensor plane to the origin. Image sensors return pixel values indexed by integer pixel coord (x s, y s ). To map pixels to 3D coordinates, we first scale the (x s, y s ) by the pixel spacings (s x, s y ). We then describe the orientation of the sensor relative to the camera projection center O c with an origin c s and a 3D rotation R s. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 47 / 61

Camera Intrinsics We then describe the orientation of the sensor relative to the camera projection center O c with an origin c s and a 3D rotation R s. The combined 2D to 3D projection can then be written as p = [ ] R s c s s x 0 0 0 s y 0 x s y s = M s p s 0 0 1 1 The matrix M s has 8 unknowns: 3 rotation, 3 translation, 2 scaling. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 48 / 61

Camera Intrinsics We then describe the orientation of the sensor relative to the camera projection center O c with an origin c s and a 3D rotation R s. The combined 2D to 3D projection can then be written as p = [ ] R s c s s x 0 0 0 s y 0 x s y s = M s p s 0 0 1 1 The matrix M s has 8 unknowns: 3 rotation, 3 translation, 2 scaling. We have ignored the possible skewing between the axes. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 48 / 61

Camera Intrinsics We then describe the orientation of the sensor relative to the camera projection center O c with an origin c s and a 3D rotation R s. The combined 2D to 3D projection can then be written as p = [ ] R s c s s x 0 0 0 s y 0 x s y s = M s p s 0 0 1 1 The matrix M s has 8 unknowns: 3 rotation, 3 translation, 2 scaling. We have ignored the possible skewing between the axes. In general only 7 dof, since the distance of the sensor from the origin cannot be teased apart from the sensor spacing Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 48 / 61

Camera Intrinsics We then describe the orientation of the sensor relative to the camera projection center O c with an origin c s and a 3D rotation R s. The combined 2D to 3D projection can then be written as p = [ ] R s c s s x 0 0 0 s y 0 x s y s = M s p s 0 0 1 1 The matrix M s has 8 unknowns: 3 rotation, 3 translation, 2 scaling. We have ignored the possible skewing between the axes. In general only 7 dof, since the distance of the sensor from the origin cannot be teased apart from the sensor spacing Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 48 / 61

Camera Calibration We know some 3D points and we want to obtain the camera intrinsics and extrinsics. The relationship between the 3D pixel center p and the 3D camera-centered point p c is given by an unknown scaling s, i.e., p = sp c. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 49 / 61

Camera Calibration We know some 3D points and we want to obtain the camera intrinsics and extrinsics. The relationship between the 3D pixel center p and the 3D camera-centered point p c is given by an unknown scaling s, i.e., p = sp c. X? X? X? x We can therefore write the complete projection as p s = αm 1 s p c = Kp c with K the calibration matrix that describes the camera intrinsic parameters. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 49 / 61

Camera Calibration We know some 3D points and we want to obtain the camera intrinsics and extrinsics. The relationship between the 3D pixel center p and the 3D camera-centered point p c is given by an unknown scaling s, i.e., p = sp c. We can therefore write the complete projection as p s = αm 1 s p c = Kp c with K the calibration matrix that describes the camera intrinsic parameters. Combining with the external parameters we have with P = K[R t] the camera matrix. p s = K [ R t ] p w = Pp w Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 49 / 61

Camera Calibration We know some 3D points and we want to obtain the camera intrinsics and extrinsics. The relationship between the 3D pixel center p and the 3D camera-centered point p c is given by an unknown scaling s, i.e., p = sp c. We can therefore write the complete projection as p s = αm 1 s p c = Kp c with K the calibration matrix that describes the camera intrinsic parameters. Combining with the external parameters we have with P = K[R t] the camera matrix. p s = K [ R t ] p w = Pp w Problem of identification, so K is assumed upper-triangular when estimated from 3D measurements. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 49 / 61

Camera Calibration We know some 3D points and we want to obtain the camera intrinsics and extrinsics. The relationship between the 3D pixel center p and the 3D camera-centered point p c is given by an unknown scaling s, i.e., p = sp c. We can therefore write the complete projection as p s = αm 1 s p c = Kp c with K the calibration matrix that describes the camera intrinsic parameters. Combining with the external parameters we have with P = K[R t] the camera matrix. p s = K [ R t ] p w = Pp w Problem of identification, so K is assumed upper-triangular when estimated from 3D measurements. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 49 / 61

Camera Calibration Thus it is typically assumed to be f x s c x K = 0 f y c y 0 0 1 with typically f x = f y and s = 0. p w = Pp w [Source: R. Szeliski] Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 50 / 61

Camera Matrix We can put intrinsics and extrinsics together in a 3 4 camera matrix P = K[R t] Or in homogeneous coordinates we have an invertible matrix [ ] [ ] K 0 R t P = 0 T 1 0 T = KE 1 with E a 3D rigid body (Euclidean) transformation. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 51 / 61

Camera Matrix We can put intrinsics and extrinsics together in a 3 4 camera matrix P = K[R t] Or in homogeneous coordinates we have an invertible matrix [ ] [ ] K 0 R t P = 0 T 1 0 T = KE 1 with E a 3D rigid body (Euclidean) transformation. We can map a 3D point in homogeneous coordinates into the image plane as p s P p w Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 51 / 61

Camera Matrix We can put intrinsics and extrinsics together in a 3 4 camera matrix P = K[R t] Or in homogeneous coordinates we have an invertible matrix [ ] [ ] K 0 R t P = 0 T 1 0 T = KE 1 with E a 3D rigid body (Euclidean) transformation. We can map a 3D point in homogeneous coordinates into the image plane as p s P p w After multiplication by P, the vector is divided by the third element of the vector to obtain the normalized form p s = (x s, y s, 1, d). Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 51 / 61

Camera Matrix We can put intrinsics and extrinsics together in a 3 4 camera matrix P = K[R t] Or in homogeneous coordinates we have an invertible matrix [ ] [ ] K 0 R t P = 0 T 1 0 T = KE 1 with E a 3D rigid body (Euclidean) transformation. We can map a 3D point in homogeneous coordinates into the image plane as p s P p w After multiplication by P, the vector is divided by the third element of the vector to obtain the normalized form p s = (x s, y s, 1, d). Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 51 / 61

Photometric image formation Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 52 / 61

Lighting: Point Source To produce an image, the scene must be illuminated with one or more light sources. A point light source originates at a single location in space. In addition to its location, a point light source has an intensity and a color spectrum, i.e., a distribution over wavelengths L(λ). The intensity of a light source falls off with the square of the distance between the source and the object being lit, because the same light is being spread over a larger (spherical) area. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 53 / 61

Lighting: More complex sources A more complex light distribution can often be represented using an environment map. This representation maps incident light directions v to color values (or wavelengths λ) L(v, λ) Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 54 / 61

Reflectance and shading When light hits an objects surface, it is scattered and reflected. The Bidirectional Reflectance Distribution Function (BRDF) is a 4D function f (θ i, φ i, θ r, φ r, λ) that describes how much of each wavelength λ arriving at an incident direction v i is emitted in a reflected direction v r. It is reciprocal, we can exchange v i and v r. Figure: (a) Light scatters when it hits a surface. (b) The BRDF is parameterized by the angles that the incident, v i and reflected, v r, light ray directions make with the surface coordinate frame (d x, d y, n). [Source: R. Szeliski] Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 55 / 61

BRDF and light For an isotropic material f r (θ i, θ r, φ i φ r, λ) or f r (v i, v r, n, λ) The amount of light exiting a surface point p in a direction v r under a given lighting condition is L r (v r, λ) = L i (v i, λ)f r (v i, v r, n, λ)max(0, cos θ i )dv i If the light sources are a discrete set of point light sources, then the integral is a sum L r (v r, λ) = i L i (λ)f r (v i, v r, n, λ)max(0, cos θ i )dv i Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 56 / 61

Diffuse Reflection Also known as Lambertian or matte reflection. Scatters light uniformly in all directions and is the phenomenon we most normally associate with shading. In this case the BRDF is constant f r (v i, v r, n, λ) = f r (λ) The amount of light depends on the angle between the incident light direction and the surface normal, θ i. The shading equation for diffuse reflection is then L d (v r, λ) = i L i (λ)f d (λ)max(0, v i n) Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 57 / 61

Specularities The second major component of the BRDF is specular reflection, which depends on the direction of the outgoing light. Incident light rays are reflected in a direction that is rotated by 180 around the surface normal n. The amount of light reflected in a given direction v r thus depends on the angle between the view direction v r and the specular direction s i. [Source: R. Szeliski] Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 58 / 61

Phong Model Combines the diffuse and specular components of reflection with another term, which he called the ambient illumination. This term accounts for the fact that objects are generally illuminated not only by point light sources but also by a general diffuse illumination corresponding to inter-reflection (e.g., the walls in a room) or distant sources such as the sky. The ambient term does not depend on surface orientation, but depends on the color of both the ambient illumination and the object L = k a (λ)l a (λ) + k d (λ) i L i (λ)max(0, v i n) + L s There exists more models, we just mentioned the most used ones. Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 59 / 61

Typical Shading Figure: Diffuse (smooth shading) and specular (shiny highlight) reflection, as well as darkening in the grooves and creases due to reduced light visibility and interreflections. Photo from the Caltech Vision Lab [Source: R. Szeliski] Raquel Urtasun (TTI-C) Visual Recognition Jan 5, 2012 60 / 61