51
Camera Model and Calibration Lecture-12

Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Camera Model and Calibration

Lecture-12

Lecture 9Guest Lecturer: Dr. Dong ZhangCRCV, UCF
Page 2: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Camera Calibration

• Determine extrinsic and intrinsic parameters of camera– Extrinsic

• 3D location and orientation of camera – Intrinsic

• Focal length• The size of the pixels

Page 3: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Application: Object Transfer

Source Image Target Image

Page 4: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Source Image Target Image

More Results

Page 5: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

More Results

Page 6: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Application in Film Industry

Page 7: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Pose Estimation

• Given 3D model of object, and its image (2D projection) determine the location and orientation (translation & rotation) of object such that when projected on the image plane it will match with the image.

http://www.youtube.com/watch?v=ZNHRH00UMvk

Page 8: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated
Page 9: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Transformations

Page 10: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

3-D Translation

Page 11: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Scaling

Page 12: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Rotation

X

Y

RR

Z

Y’

Y

X’X

Page 13: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Rotation matrices are orthonormal matrices

Page 14: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Euler Angles

if angles are small 1cos |4 4|4sin

Rotation around an arbitrary axis:

Page 15: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Perspective Projection (origin at the lens center)

(X,Y,Z)

LensImage Plane

image Zy

fWorldpoint

0

ZfX

xZfY

y

Zf

Yy

� �

Page 16: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Perspective Projection (origin at image center)

(X,Y,Z)

LensImage Plane

imageZy

fWorldpoint

0

Page 17: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Perspective

Imagecoordinates World coordinates

Page 18: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Perspective

Page 19: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Camera Model

• Camera is at the origin of the world coordinates first• Then translated by some amount(G), • Then rotated around Z axis in counter clockwise direction, • Then rotated again around X in counter clockwise direction, and• Then translated by C.

Since we are moving the camera instead of object we need to use inverse transformations

Page 20: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Camera Model

Page 21: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Camera Model

Page 22: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Camera Model

Ch3 is not needed, we have 12 unknowns.

Page 23: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Camera Model

• How to determine camera matrix?• Select some known 3D points (X,Y,Z), and

find their corresponding image points (x,y).• Solve for camera matrix elements using

least squares fit.

Page 24: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Camera Model

Ch3 is not needed, we have 12unknowns.

Page 25: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Camera Model

Page 26: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Camera ModelOne point

n points2n equations, 12 unknowns

Page 27: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Camera Model

This is a homogenous system, no unique solution

Select

Page 28: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Camera Model

Pseudo inverseLeast squares fit

Page 29: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Finding Camera Location

• Take one 3D point X1 and find its image homogenous coordinates.

• Set the third component of homogenous coordinates to zero, find corresponding World coordinates of that point, X11

• Connect X1 and X11 to get a line in 3D.

• Repeat this for another 3D point X2 and find another line

• Two lines will intersect at the location of camera.

Page 30: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Camera Location

Page 31: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Camera Orientation

• Only time the image will be formed at infinity if Ch4=0.

• This is equation of a plane, going through the lens, which is parallel to image plane.

Page 32: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Application

Camera location: intersection of California and Mason streets, at an elevation of 435 feetabove sea level. The camera was oriented at an angle of 80 above the horizon. fsx=495, fsy=560.

Page 33: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Application

Camera location: at an elevation of 1200 feetabove sea level. The camera was oriented at an angle of 40 above the horizon. fsx=876, fsy=999.

Recovering the camera parameters from a transformation matrixTM Strat - Readings in Computer Vision, 1987

Page 34: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Camera Parameters• Extrinsic parameters

– Parameters that define the location and orientation of the camera reference frame with respect to a known world reference frame

• 3-D translation vector• A 3 by 3 rotation matrix

• Intrinsic parameters– Parameters necessary to link the pixel coordinates of

an image point with the corresponding coordinates in the camera reference frame

• Perspective projection (focal length)• Transformation between camera frame coordinates and pixel

coordinates

Page 35: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Camera Model Revisited: Rotation & Translation

Page 36: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Perspective Projection: Revisited

(X,Y,Z)

Lens

Image Plane

Z

y

f

WorldpointY

Origin at the lensImage plane in front of the lens

Page 37: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Camera Model Revisited: Perspective

Origin at the lensImage plane in front of the lens

Page 38: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

image coordinatescamera coordinatesimage center (in pixels)effective size of pixels (in

millimeters) in the horizontal and vertical directions.

Camera Model Revisited: Image and Camera coordinates

Page 39: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Camera Model Revisited

Page 40: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Camera Model Revisited

Page 41: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Camera Model Revisited

fx effective focal length expressed in effective horizontal pixel size

Page 42: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Computing Camera Parameters• Using known 3-D points and corresponding

image points, estimate camera matrix employing pseudo inverse method of section 1.6 (Fundamental of Computer Vision).

• Compute camera parameters by relating camera matrix with estimated camera matrix.– Extrinsic

• Translation• Rotation

– Intrinsic• Horizontal fx and fy vertical focal lengths• Translation ox and oy

Page 43: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Comparison

Page 44: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Computing Camera Parameters

Since M is defined up to a scale factor

estimated

Divide each entry of by .

Because rotation matrixis orthonormal

Page 45: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Computing Camera Parameters

Page 46: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Computing Camera Parameters: estimating third row of rotation matrix and translation in depth

Since we can determine Tz>0 (origin of worldreference is in front)Or Tz<0(origin of world reference is in back)we can determine sign.

Page 47: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Computing Camera Parameters

Let

Page 48: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Computing Camera Parameters: origin of image

Therefore:

Page 49: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Computing Camera Parameters: vertical and horizontal focal lengths

Therefore:

Page 50: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Computing Camera Parameters: remaining rotation and translation

parameters

Page 51: Camera Model and Calibration - UCF Computer Sciencebagci/teaching/computervision16/Lec9.pdf · Camera Model •Camera is at the origin of the world coordinates first •Then translated

Reading Material• Chapter 1, Fundamental Of Computer Vision, Mubarak Shah• Chapter 6, Introductory Techniques, E. Trucco and A. Verri,

Prentice Hall, 1998.• Recovering the camera parameters from a transformation matrix,

TM Strat - Readings in Computer Vision, 1987