0% found this document useful (0 votes)
19 views4 pages

Exercise 1

Uploaded by

dio din
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views4 pages

Exercise 1

Uploaded by

dio din
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

ETH Zürich Prof.

Marc Pollefeys
Computer Science Department Prof. Luc Van Gool
HS 2012

Computer Vision
Exercise 1
Hand-out: 27-09-2012
Hand-in: 04-10-2012 13:00

Objective:
In this exercise you will calibrate your own camera. Two algorithms will be implemented:
the simple Direct Linear Transform algorithm and the Gold Standard algorithm.
As a preparatory step you have to make an image of a 3D calibration object. An
easy way to generate such an object is to stick two checkerboard patterns (http://
www.vision.caltech.edu/bouguetj/calib_doc/htmls/pattern.pdf) to two
orthogonal planes (e.g. walls in a room). An example is shown in Figure 1. Make sure
that the object fills almost the whole image to get a more precise calibration.
The calibration can be determined from 3D to 2D correspondences. To get the 3D coordi-
nates, you can simply put the origin of the coordinate system somewhere on the calibration
object. When taking multiple images, make sure to keep the coordinate systems consistent.
The code framework provides a function for clicking points in the image. For each clicked
image point you have to enter the corresponding 3D-coordinate.
Make sure you use the same camera with the same settings for ALL tasks!
The 2D coordinates x and the 3D coordinates X are homogeneous vectors.

Figure 1: Typical calibration object.


1.1 Data Normalization (20%)
Data normalization is an essential part of the DLT algorithm. For all points, scale
the homogenous vectors such that the last entry becomes 1, i.e., x = ( x, y, 1)> and
X = ( x, y, z, 1)> .
The first step is to transform the 2D and 3D input points so that the centroid√ of the points
is at the origin and √ that the average Euclidean distance from the origin is p2 (for the im-
age
p points) and 3 (for the object points). The distance to the origin is x2 + y2 and
x2 + y2 + z2 , respectively. Find transformation matrices T and U such that the normal-
ized image points are x̂i = Txi and the normalized object points are X̂i = UXi (again, the
last entries are 1).

1.2 Direct Linear Transform (30%)


Implement the DLT algorithm to estimate the camera matrix from the given point corre-
spondences. The DLT algorithm minimizes an algebraic error.

• Compute the normalized camera matrix ^


P with the DLT algorithm:
Each correspondence X̂i ↔ x̂i leads to two equations

P̂1
 
wi X̂i> 0> − xi X̂i>
 
P̂2  = 0 (1)
0> −wi X̂i> yi X̂i>
P̂3

where P̂i are the transposed row vectors of ^


P.
Stacking the equations for all point correspondences results in a 2n × 12 matrix A
where AP = 0. The solution for P is the right null-vector of A and can be computed
with the singular value decomposition of A.

• Compute the denormalized camera matrix P = T−1 ^


PU.

• Factorize the camera matrix into the intrinsic matrix K, the rotation matrix R and the
camera center C.

P = [M|−MC] = K[R|−RC], (2)

where M = KR is the product of the intrinsic matrix and the camera rotation matrix and
C is the camera center. The matrix M can be decomposed with a RQ-decomposition.
The camera center C is the right null-vector of P.

• Visualize the hand-clicked points and the reprojection of the 3D points on the cali-
bration object obtained by using the computed camera matrix.

• What happens if you use the unnormalized points? Compare the intrinsic parameters
and the reprojection errors.
1.3 Gold Standard algorithm (30%)
The Gold Standard algorithm minimizes the geometric error ∑i d(xi , x̂i )2 where xi is the
measured (clicked) point and x̂i is the projected object point PXi . d(xi , x̂i ) is the Euclidean
distance between the 2D points given by xi and x̂i .

• Normalize the input points and run the DLT algorithm to get an initial camera matrix
P̃ for the optimization.
• Minimize the geometric error ∑i d(xi , x̂i )2 over the normalized camera matrix ~
P.
Check the MATLAB function fminsearch or lsqnonlin.
• Denormalize and factorize the camera matrix as in task 1.
• Visualize the hand-clicked points and the reprojection of the points on the calibration
object obtained by using the computed camera matrix.

1.4 Bouguet’s Calibration Toolbox (20%)


There is a standard toolbox for MATLAB that is widely used for camera calibration. The
toolbox can be downloaded from [1]. Read the instructions and the tutorial on the website
and calibrate your own camera. You need to print out a calibration pattern, stick it to a
planar surface and make multiple (10-15) images of it. Compare the intrinsic parameters
obtained using this method with the results obtained by using your own calibration object
and calibration functions.

1.5 Gold Standard algorithm with radial distortion estimation (+10% bonus)
During the optimization of P also the coefficients of the radial distortion introduced by the
lens can be estimated. A commonly used model for radial distortion is
     
xd x̃ 2 4 x̃
= L(r̃ ) = (1 + κ1 r̃ + κ2 r̃ ) (3)
yd ỹ ỹ
where ( x̃, ỹ) is the ideal pinhole projection of a 3D point X
 
x
 y  = [R|−RC]X
z
x̃ = x/z
ỹ = y/z
and ( xd , yd ) is the position after radial distortion. To compute the actual position in the
image, the pposition ( xd , yd , 1) has to be multiplied with the intrinsic matrix K. r̃ is the radial
distance x̃2 + ỹ2 from the center of radial distortion.
The center of the radial distortion can be assumed to be the same as the principal point
( p x , p y ).
Redo task 1.3, but this time jointly estimate the projection matrix P and the distortion coef-
ficients κ1 and κ2 .
Hand in:
Write a short report explaining the main steps of your implementation. Compare the re-
sults obtained by using the DLT method with and without data normalization, the Gold
Standard, the Gold Standard including radial distortion (bonus) and result obtained by
using Bouguet’s toolbox. Discuss the intrinsic parameters and the average reprojection er-
rors. The report should contain images showing the clicked 2D points before calibration
and the reprojected 3D points obtained by using the calibration parameters. Send the re-
port together with your source code to [email protected]. Additionally, include the
hand-clicked 3D to 2D correspondences used for calibration stored as a Matlab .mat-File
and the image of your calibration object.

References:
[1] http://www.vision.caltech.edu/bouguetj/calib_doc/index.html

You might also like