Camera Parameters: Extrinsics and Intrinsics

76
1 Photogrammetry & Robotics Lab Camera Parameters: Extrinsics and Intrinsics Cyrill Stachniss The slides have been created by Cyrill Stachniss.

Transcript of Camera Parameters: Extrinsics and Intrinsics

Page 1: Camera Parameters: Extrinsics and Intrinsics

1

Photogrammetry & Robotics Lab

Camera Parameters: Extrinsics and Intrinsics

Cyrill Stachniss

The slides have been created by Cyrill Stachniss.

Page 2: Camera Parameters: Extrinsics and Intrinsics

2

5 Minute Preparation for Today

https://www.ipb.uni-bonn.de/5min/

Page 3: Camera Parameters: Extrinsics and Intrinsics

3

5 Minute Preparation for Today

https://www.ipb.uni-bonn.de/5min/

Page 4: Camera Parameters: Extrinsics and Intrinsics

4

Goal: Describe How a Point is Mapped to a Pixel Coordinate

pixel coordinate

world coordinate

trans- formation

Page 5: Camera Parameters: Extrinsics and Intrinsics

5

Goal: Describe How a 3D Point is Mapped to a 2D Pixel Coord.

2D pixel coordinate

3D world coordinate

trans- formation

Page 6: Camera Parameters: Extrinsics and Intrinsics

6

Coordinate Systems

1. World/object coordinate system

2. Camera coordinate system

3.  Image plane coordinate system

4. Sensor coordinate system

Page 7: Camera Parameters: Extrinsics and Intrinsics

7

Coordinate Systems

1. World/object coordinate system written as:

2. Camera coordinate system written as:

3.  Image plane coordinate system written as:

4. Sensor coordinate system written as:

no index means object system

Page 8: Camera Parameters: Extrinsics and Intrinsics

8

Transformation

We want to compute the mapping

in the sensor system

in the object system

image plane

to sensor

camera to

image

object to

camera

Page 9: Camera Parameters: Extrinsics and Intrinsics

9

Example

Image courtesy: Förstner

image plane

camera origin

Page 10: Camera Parameters: Extrinsics and Intrinsics

10

Example

image plane

camera origin

The directions of the x-and y-axes in the c.s. k and c are identical. The origin of

the c.s. c expressed in k is (0, 0, c)

(with )

Page 11: Camera Parameters: Extrinsics and Intrinsics

11

From the World to the Sensor

ideal projection (3D to 2D)

image to sensor (2D)

deviation from the linear model

(2D)

object to camera (3D)

Page 12: Camera Parameters: Extrinsics and Intrinsics

12

Extrinsic & Intrinsic Parameters

§  Extrinsic parameters describe the pose of the camera in the world

§  Intrinsic parameters describe the mapping of the scene in front of the camera to the pixels in the final image (sensor)

extrinsics intrinsics

Page 13: Camera Parameters: Extrinsics and Intrinsics

13

Extrinsic Parameters

Page 14: Camera Parameters: Extrinsics and Intrinsics

14

Where Are We in the Process?

extrinsics

Page 15: Camera Parameters: Extrinsics and Intrinsics

15

Extrinsic Parameters

§  Describe the pose (pose = position and heading) of the camera with respect to the world

§  Invertible transformation

How many parameters are needed?

6 parameters: 3 for the position + 3 for the heading

Page 16: Camera Parameters: Extrinsics and Intrinsics

16

Extrinsic Parameters

§  Point with coordinates in world coordinates

§  Center of the projection (origin of the camera coordinate system)

§  is sometimes also called or

Page 17: Camera Parameters: Extrinsics and Intrinsics

17

Transformation

§  Translation between the origin of the world c.s. and the camera c.s.

§  Rotation from to . §  In Euclidian coordinates this yields

Page 18: Camera Parameters: Extrinsics and Intrinsics

18

Transformation in H.C.

§  In Euclidian coordinates §  Expressed in Homogeneous Coord.

§  or written in short as

with

Euclidian H.C.

Page 19: Camera Parameters: Extrinsics and Intrinsics

19

Intrinsic Parameters

Page 20: Camera Parameters: Extrinsics and Intrinsics

20

Intrinsic Parameters

§  The process of projecting points from the camera c.s. to the sensor c.s.

§  Invertible transformations: §  image plane to sensor § model deviations

§  Not invertible: central projection

Page 21: Camera Parameters: Extrinsics and Intrinsics

21

Mapping as a 3 Step Process

We split up the mapping into 3 steps 1.  Ideal perspective projection to the

image plane 2. Mapping to the sensor coordinate

system (“where the pixels are”) 3. Compensation for the fact that the

two previous mappings are idealized

Image courtesy: Förstner

Page 22: Camera Parameters: Extrinsics and Intrinsics

22

Where Are We in the Process?

extrinsics intrinsics

rigid body

central projection

Page 23: Camera Parameters: Extrinsics and Intrinsics

23

Ideal Perspective Projection

§  Distortion-free lens §  All rays are straight lines and pass

through the projection center. This point is the origin of the camera coordinate system

§  Focal point and principal point lie on the optical axis

§  The distance from the camera origin to the image plane is the constant

Page 24: Camera Parameters: Extrinsics and Intrinsics

24

Image Coordinate System

Physically motivated coordinate system: c>0

Most popular image coordinate system: c<0

rotation by 180 deg

Image courtesy: Förstner

Page 25: Camera Parameters: Extrinsics and Intrinsics

25

Camera Constant

§  Distance between the center of projection and the principal point

§  Value is computed as part of the camera calibration

§  Here: coordinate system with

Image courtesy: Förstner

Page 26: Camera Parameters: Extrinsics and Intrinsics

26

Ideal Perspective Projection

Through the intercept theorem, we obtain for the point projected onto the image plane the coordinates

Page 27: Camera Parameters: Extrinsics and Intrinsics

27

Ideal Perspective Projection

Through the intercept theorem, we obtain for the point projected onto the image plane the coordinates

Page 28: Camera Parameters: Extrinsics and Intrinsics

28

In Homogenous Coordinates

§  We can express that in H.C.

§  and drop the 3rd coordinate (row)

Page 29: Camera Parameters: Extrinsics and Intrinsics

29

Verify the Result

§  Ideal perspective projection is

§  Our results is

Page 30: Camera Parameters: Extrinsics and Intrinsics

30

In Homogenous Coordinates

§  Thus, we can write for any point

§  with

Page 31: Camera Parameters: Extrinsics and Intrinsics

31

Assuming an Ideal Camera…

…leads us to the mapping using the intrinsic and extrinsic parameters with

Page 32: Camera Parameters: Extrinsics and Intrinsics

32

Calibration Matrix

§  We can now define the calibration matrix for the ideal camera

§  We can write the overall mapping as

3x4 matrices

Page 33: Camera Parameters: Extrinsics and Intrinsics

33

Notation

We can write the overall mapping as

short for

Page 34: Camera Parameters: Extrinsics and Intrinsics

34

Calibration Matrix

§  We have the projection

§  that maps a point to the image plane

§  and yields for the coordinates of

Page 35: Camera Parameters: Extrinsics and Intrinsics

35

In Euclidian Coordinates

§  This leads to the so-called collinearity equation for the image coordinates

Page 36: Camera Parameters: Extrinsics and Intrinsics

36

Mapping to the Sensor (wihtout non-linear errors)

Page 37: Camera Parameters: Extrinsics and Intrinsics

37

Where Are We in the Process?

extrinsics intrinsics

rigid body

central projection

affine trans.

Page 38: Camera Parameters: Extrinsics and Intrinsics

38

Linear Errors

§  The next step is the mapping from the image to the sensor

§  Location of the principal point in the image

§  Scale difference in x and y based on the chip design

§  Shear compensation

Page 39: Camera Parameters: Extrinsics and Intrinsics

39

Location of the Principal Point

§  The origin of the sensor system is not at the principal point

§  Compensation through a shift

Page 40: Camera Parameters: Extrinsics and Intrinsics

40

Shear and Scale Difference

§  Scale difference in x and y §  Shear compensation (for digital

cameras, we typically have )

§  Finally, we obtain

Page 41: Camera Parameters: Extrinsics and Intrinsics

41

Calibration Matrix

Often, the transformation is combined with the calibration matrix , i.e.

Page 42: Camera Parameters: Extrinsics and Intrinsics

42

Calibration Matrix

§  This calibration matrix is an affine transformation

§  contains 5 parameters: §  camera constant: §  principal point: §  scale difference: §  shear:

Page 43: Camera Parameters: Extrinsics and Intrinsics

43

DLT: Direct Linear Transform

§  The mapping §  with and §  is called the direct linear transform §  It is the model of the affine camera §  Affine camera = camera with an

affine mapping to the sensor c.s. (after the central projection is applied)

Page 44: Camera Parameters: Extrinsics and Intrinsics

44

DLT: Direct Linear Transform

§  The homogeneous projection matrix

§  contains 11 parameters §  6 extrinsic parameters: §  5 intrinsic parameters:

Page 45: Camera Parameters: Extrinsics and Intrinsics

45

DLT: Direct Linear Transform

§  The homogeneous projection matrix

§  contains 11 parameters §  6 extrinsic parameters: §  5 intrinsic parameters:

§  Euclidian world:

Page 46: Camera Parameters: Extrinsics and Intrinsics

46

Non-Linear Errors

Page 47: Camera Parameters: Extrinsics and Intrinsics

47

Where Are We in the Process?

extrinsics intrinsics

rigid body

central projection

affine trans.

non-linear trans.

Page 48: Camera Parameters: Extrinsics and Intrinsics

48

Non-Linear Errors

§  So far, we considered only linear errors (DLT)

§  The real world is non-linear §  Reasons for non-linear errors

Page 49: Camera Parameters: Extrinsics and Intrinsics

49

Non-Linear Errors

§  So far, we considered only linear errors (DLT)

§  The real world is non-linear §  Reasons for non-linear errors

§  Imperfect lens §  Planarity of the sensor § …

Page 50: Camera Parameters: Extrinsics and Intrinsics

50

General Mapping

§  Idea: add a last step that covers the non-linear effects

§  Location-dependent shift in the sensor coordinate system

§  Individual shift for each pixel §  General mapping

in the image plane

Page 51: Camera Parameters: Extrinsics and Intrinsics

51

Example

Image courtesy: Abraham

Left:not straight line preserving Right: rectified image

Page 52: Camera Parameters: Extrinsics and Intrinsics

52

General Mapping in H.C.

§  General mapping yields

§  with

§  so that the overall mapping becomes

Page 53: Camera Parameters: Extrinsics and Intrinsics

53

General Calibration Matrix

§  General calibration matrix is obtained by combining the one of the affine camera with the general mapping

§  resulting in the general camera model

Page 54: Camera Parameters: Extrinsics and Intrinsics

54

Approaches for Modeling

Large number of different approaches to model the non-linear errors

Physics approach §  Well motivated §  There are large number of reasons for

non-linear errors … Phenomenological approaches §  Just model the effects §  Easier but do not identify the problem

Page 55: Camera Parameters: Extrinsics and Intrinsics

55

Example: Barrel Distortion

§  A standard approach for wide angle lenses is to model the barrel distortion

§  with being point as projected by an ideal pin-hole camera

§  with being the distance of the pixel in the image to the principal point

§  The terms are the additional parameters of the general mapping

Page 56: Camera Parameters: Extrinsics and Intrinsics

56

Radial Distortion Example

–1

–0.5

0.5

1

y

–1 –0.5 0.5 1x

Image courtesy: Förstner

Page 57: Camera Parameters: Extrinsics and Intrinsics

57

Mapping as a Two Step Process

1. Projection of the affine camera

2. Consideration of non-linear effects

Individual mapping for each point!

Page 58: Camera Parameters: Extrinsics and Intrinsics

58

What to Do If We Want to Get Information About the Scene?

Page 59: Camera Parameters: Extrinsics and Intrinsics

59

Inversion of the Mapping

§  Goal: map from back to §  1st step: §  2nd step:

Page 60: Camera Parameters: Extrinsics and Intrinsics

60

Inversion of the Mapping

§  Goal: map from back to §  1st step: §  2nd step:

§  The general nature of in requires an iterative solution

depends on the coordinate of the point to transform

Page 61: Camera Parameters: Extrinsics and Intrinsics

61

Inversion Step 1:

§  Iteration due to unknown in §  Start with as the initial guess

§  and iterate

§  As is often a good initial guess, this procedure converges quickly

often w.r.t. the principal point

Page 62: Camera Parameters: Extrinsics and Intrinsics

62

Inversion Step 2:

§  The next step is the inversion of the projective mapping

§  We cannot reconstruct the 3D point but the ray though the 3D point

§  With the known matrix , we can write

factor resulting from the H.C.

Page 63: Camera Parameters: Extrinsics and Intrinsics

63

Inversion Step 2:

§  Starting from §  we obtain

§  The term describes the direction of the ray from the camera origin to the 3D point

Page 64: Camera Parameters: Extrinsics and Intrinsics

64

Classification of Cameras extrinsic parameters intrinsic parameters

Page 65: Camera Parameters: Extrinsics and Intrinsics

65

Classification of Cameras extrinsic parameters

normalized

Example: pinhole camera for which the principal point is the origin of the image coordinate system, the x- and y-axis of the image coordinate system is aligned with the x-/y-axis of the world c.s. and the distance between the origin and the image plane is 1

Page 66: Camera Parameters: Extrinsics and Intrinsics

66

Classification of Cameras extrinsic parameters

unit camera

normalized

Example: pinhole camera for which the principal point (x, y) is the origin of the image coordinate system and the distance between the origin and the image plane is 1

Page 67: Camera Parameters: Extrinsics and Intrinsics

67

Classification of Cameras extrinsic parameters intrinsic parameters

ideal camera

unit camera

normalized

Example: pinhole camera for which the x/y coordinate of the principal point is the origin of the image coordinate system

Page 68: Camera Parameters: Extrinsics and Intrinsics

68

Classification of Cameras extrinsic parameters intrinsic parameters

ideal camera

Euclidian camera

unit camera

normalized

Example: pinhole camera using a Euclidian sensor in the image plane

Page 69: Camera Parameters: Extrinsics and Intrinsics

69

Classification of Cameras extrinsic parameters intrinsic parameters

ideal camera

Euclidian camera

affine camera

unit camera

normalized

Example: camera that preserves straight lines

Page 70: Camera Parameters: Extrinsics and Intrinsics

70

Classification of Cameras extrinsic parameters intrinsic parameters

ideal camera

Euclidian camera

affine camera

general camera

unit camera

normalized

Example: camera with non-linear distortions

Page 71: Camera Parameters: Extrinsics and Intrinsics

71

Calibration Matrices

ideal

Euclidian

affine

general

7 (6+1)

9 (6+3)

11 (6+5)

11+N

camera calibration matrix #parameters unit 6 (6+0)

Page 72: Camera Parameters: Extrinsics and Intrinsics

72

Calibrated Camera

§  If the intrinsics are unknown, we call the camera uncalibrated

§  If the intrinsics are known, we call the camera calibrated

§  The process of obtaining the intrinsics is called camera calibration

§  If the intrinsics are known and do not change, the camera is called metric camera

Page 73: Camera Parameters: Extrinsics and Intrinsics

73

Summary §  We described the mapping from the

world c.s. to individual pixels (sensor) §  Extrinsics = world to camera c.s. §  Intrinsics = camera to sensor c.s. §  DLT = Direct linear transform §  Non-linear errors §  Inversion of the mapping process

Page 74: Camera Parameters: Extrinsics and Intrinsics

74

Summary of the Mapping

extrinsics intrinsics

rigid body

affine trans.

central projection

non-linear trans.

Page 75: Camera Parameters: Extrinsics and Intrinsics

75

Literature

§  Förstner & Wrobel, Photogrammetric Computer Vision, Chapter “Geometry of the Single Image”, 11.1.1 – 11.1.6

§  Förstner, Scriptum Photogrammetrie I, Chapter “Einbild-Photogrammetrie”, subsections 1 & 2

Page 76: Camera Parameters: Extrinsics and Intrinsics

76

Slide Information §  The slides have been created by Cyrill Stachniss as part of the

photogrammetry and robotics courses. §  I tried to acknowledge all people from whom I used

images or videos. In case I made a mistake or missed someone, please let me know.

§  The photogrammetry material heavily relies on the very well written lecture notes by Wolfgang Förstner and the Photogrammetric Computer Vision book by Förstner & Wrobel.

§  Parts of the robotics material stems from the great Probabilistic Robotics book by Thrun, Burgard and Fox.

§  If you are a university lecturer, feel free to use the course material. If you adapt the course material, please make sure that you keep the acknowledgements to others and please acknowledge me as well. To satisfy my own curiosity, please send me email notice if you use my slides. Cyrill Stachniss, [email protected]