p_compute - computes the projection matrix P of a camera from a list of 2D-3D correspondances
p_compute [OPTIONS]
p_compute evaluates the 'projection matrix' P of a camera from a list of 2D-3D correspondances. It takes its input from the standard input and returns the result to the standard output. The P matrix models a central projection camera. It can be used to map a point x on the object to his projection u, following the formula u = Px (using homogeneous coordinates). P is the product of two matrices: P = KR. To a first approximation, K, the 'camera calibration matrix', is constant for a given camera. It is an upper triangular matrix and it depends mainly of the focal length of the camera (expressed in pixels) with some added parameters allowing anistropy, skewness and an offset of the principal point. The 5 parameters of K are called the 'internal camera parameters'. If K is known, i.e if the camera was already calibrated, option -i can be used to take advantage of this knowledge. R is a matrix representing the position and orientation of the camera. It is a 3x4 matrix of the form [r|-rc], where r is a 3x3 rotation matrix (3 parameters) and c is the position of the camera (3 parameters). The 6 parameters of R are called the 'external camera parameters'. P has 11 degrees of freedom. Each point correspondance gives two equations, so at least 6 point correspondances should be given to estimate P. Clearly, a robust estimation of P requires specific conditions on the number of correspondances and their quality. The computations are made using the VxL library (mvl). The pickpoint script can be used to interactively measure points in 2D on an image (using pixelpoint(1)) and trigger measurements of the corresponding object point (3D) (using a total station).
input stream (or file):
Returns the manual page
CHAR is a code fixing the output type. f: [P matrix (3x4 matrix), default] i: [camera calibration matrix (3x3 matrix)] e: [external orientation matrix (3x4 matrix)]
Option used when the camera (its camera calibration matrix) is known. STRING is the name of a file with the camera calibration matrix (3x3 matrix).
homogeneous points are entered: ui vi wi xi yi zi ti
this option triggers a non-linear least-square optimisation of the parameters of P, after the linear estimation (Levenberg-Marquardt algorithm).
calculates and output radial distortion parameters (xc, yc, k1, k2, k3). The option automatically triggers non-linear optimisation.
the camera calibration matrix assumes squared pixels (default: rectangular pixels allowed). The option automatically triggers non-linear optimisation.
no skew parameter in the camera calibration matrix (default: skew allowed). The option automatically triggers non-linear optimisation.
output the average distance between measured and estimated image points during the iterative process.
quiet output: do not output RMS error, possibly after non-linear optimisation and the number of iterations necessary to reach convergence.
Written by Pierre Smars (first version: 2008)
Reports of bugs or problems should be submitted via electronic mail to <smars@yuntech.edu.tw>.
Copyright (C) 2015 Pierre Smars. License GPLv2 <http://www.gnu.org/licenses/gpl-2.0.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
pickpoint, project(1), view_tri(1), pixelpos(1), h_compute(1)