Operators

vector_to_fundamental_matrix_distortion (Operator)

Name

vector_to_fundamental_matrix_distortion — Compute the fundamental matrix and the radial distortion coefficient given a set of image point correspondences and reconstruct 3D points.

Signature

vector_to_fundamental_matrix_distortion( : : Rows1, Cols1, Rows2, Cols2, CovRR1, CovRC1, CovCC1, CovRR2, CovRC2, CovCC2, ImageWidth, ImageHeight, Method : FMatrix, Kappa, Error, X, Y, Z, W)

Description

For a stereo configuration with unknown camera parameters, the geometric relation between the two images is defined by the fundamental matrix. vector_to_fundamental_matrix_distortion determines the fundamental matrix FMatrix and the radial distortion coefficient Kappa from given point correspondences (Rows1,Cols1), (Rows2,Cols2) that fulfill the epipolar constraint:

T
/ c2 \             / c1 \
| r2 | * FMatrix * | r1 | = 0  .
\  1 /             \  1 /

Here, (r1,c1) and (r2,c2) denote image points that are obtained by undistorting the input image points with the division model (see calibrate_cameras):

r = r' / (1+Kappa*(r'^2+c'^2)
c = c' / (1+Kappa*(r'^2+c'^2)

Here, (r1',c1') = (Rows1-0.5*(ImageHeight-1), Cols1-0.5*(ImageWidth-1)) and (r2',c2') = (Rows2-0.5*(ImageHeight-1), Cols2-0.5*(ImageWidth-1)) denote the distorted image points, specified relative to the image center. Thus, vector_to_fundamental_matrix_distortion assumes that the principal point of the camera, i.e., the center of the radial distortions, lies at the center of the image.

The returned Kappa can be used to construct camera parameters that can be used to rectify images or points (see change_radial_distortion_cam_par, change_radial_distortion_image, and change_radial_distortion_points):

CamPar = [0.0,Kappa,1.0,1.0,
0.5*(ImageWidth-1),0.5*(ImageHeight-1),
ImageWidth,ImageHeight]

Note the column/row ordering in the point coordinates above: since the fundamental matrix encodes the projective relation between two stereo images embedded in 3D space, the x/y notation must be compliant with the camera coordinate system. Therefore, (x,y) coordinates correspond to (column,row) pairs.

For a general relative orientation of the two cameras, the minimum number of required point correspondences is nine. Then, Method must be set to 'linear' or 'gold_standard'. If the left and right cameras are identical and the relative orientation between them is a pure translation, Method must be set to 'trans_linear' or 'trans_gold_standard'. In this special case, the minimum number of correspondences is only four. The typical application of the motion being a pure translation is a single fixed camera looking onto a moving conveyor belt.

The fundamental matrix is determined by minimizing a cost function. To minimize the respective error, different algorithms are available, and the user can choose between the linear ('linear') and the gold-standard algorithm ('gold_standard'). Like the motion type, the algorithm can be selected with the parameter Method. For Method = 'linear' or 'trans_linear', a linear algorithm that minimizes an algebraic error based on the above epipolar constraint is used. This algorithm is very fast. For the pure translation case (Method = 'trans_linear'), the linear method returns accurate results for small to moderate noise of the point coordinates and for most distortions (except for very small distortions). For a general relative orientation of the two cameras (Method = 'linear'), the linear method only returns accurate results for very small noise of the point coordinates and for sufficiently large distortions. For Method = 'gold_standard' or 'trans_gold_standard', a mathematically optimal but slower optimization is used, which minimizes the geometric reprojection error of reconstructed projective 3D points. In this case, in addition to the fundamental matrix and the distortion coefficient, the projective coordinates (X,Y,Z,W) of the reconstructed points are returned. For a general relative orientation of the two cameras, in general Method = 'gold_standard' should be selected.

If an optimal gold-standard algorithm is chosen, the covariances of the image points (CovRR1, CovRC1, CovCC1, CovRR2, CovRC2, CovCC2) can be incorporated into the computation. They can be provided, for example, by the operator points_foerstner. If the point covariances are unknown, which is the default, empty tuples are passed. In this case, the optimization algorithm internally assumes uniform and equal covariances for all points.

The value Error indicates the overall quality of the optimization procedure and is the mean symmetric euclidian distance in pixels between the points and their corresponding epipolar lines.

If the correspondence between the points is not known, match_fundamental_matrix_distortion_ransac should be used instead.

Parallelization

• Multithreading type: reentrant (runs in parallel with non-exclusive operators).
• Processed without parallelization.

Parameters

Rows1 (input_control)  point.y-array (real / integer)

Input points in image 1 (row coordinate).

Restriction: length(Rows1) >= 9 || length(Rows1) >= 4

Cols1 (input_control)  point.x-array (real / integer)

Input points in image 1 (column coordinate).

Restriction: length(Cols1) == length(Rows1)

Rows2 (input_control)  point.y-array (real / integer)

Input points in image 2 (row coordinate).

Restriction: length(Rows2) == length(Rows1)

Cols2 (input_control)  point.x-array (real / integer)

Input points in image 2 (column coordinate).

Restriction: length(Cols2) == length(Rows1)

CovRR1 (input_control)  number-array (real / integer)

Row coordinate variance of the points in image 1.

Default value: []

CovRC1 (input_control)  number-array (real / integer)

Covariance of the points in image 1.

Default value: []

CovCC1 (input_control)  number-array (real / integer)

Column coordinate variance of the points in image 1.

Default value: []

CovRR2 (input_control)  number-array (real / integer)

Row coordinate variance of the points in image 2.

Default value: []

CovRC2 (input_control)  number-array (real / integer)

Covariance of the points in image 2.

Default value: []

CovCC2 (input_control)  number-array (real / integer)

Column coordinate variance of the points in image 2.

Default value: []

ImageWidth (input_control)  integer (integer)

Width of the images from which the points were extracted.

Restriction: ImageWidth > 0

ImageHeight (input_control)  integer (integer)

Height of the images from which the points were extracted.

Restriction: ImageHeight > 0

Method (input_control)  string (string)

Estimation algorithm.

Default value: 'gold_standard'

List of values: 'gold_standard', 'linear', 'trans_gold_standard', 'trans_linear'

FMatrix (output_control)  hom_mat2d (real)

Computed fundamental matrix.

Kappa (output_control)  real (real)

Error (output_control)  real (real)

Root-Mean-Square epipolar distance error.

X (output_control)  real-array (real)

X coordinates of the reconstructed points in projective 3D space.

Y (output_control)  real-array (real)

Y coordinates of the reconstructed points in projective 3D space.

Z (output_control)  real-array (real)

Z coordinates of the reconstructed points in projective 3D space.

W (output_control)  real-array (real)

W coordinates of the reconstructed points in projective 3D space.