Operators

vector_to_essential_matrix (Operator)

Name

vector_to_essential_matrix — Compute the essential matrix given image point correspondences and known camera matrices and reconstruct 3D points.

Signature

vector_to_essential_matrix( : : Rows1, Cols1, Rows2, Cols2, CovRR1, CovRC1, CovCC1, CovRR2, CovRC2, CovCC2, CamMat1, CamMat2, Method : EMatrix, CovEMat, Error, X, Y, Z, CovXYZ)

Description

For a stereo configuration with known camera matrices the geometric relation between the two images is defined by the essential matrix. The operator vector_to_essential_matrix determines the essential matrix EMatrix from in general at least six given point correspondences, that fulfill the epipolar constraint:

T
/ X2 \             / X1 \
| Y2 | * EMatrix * | Y1 |  =  0
\  1 /             \  1 /

The operator vector_to_essential_matrix is designed to deal only with a linear camera model. This is in constrast to the operator vector_to_rel_pose, that encompasses lens distortions too. The internal camera parameters are passed by the arguments CamMat1 and CamMat2, which are 3x3 upper triangular matrices desribing an affine transformation. The relation between the vector (X,Y,1), defining the direction from the camera to the viewed 3D point, and its (projective) 2D image coordinates (col,row,1) is:

/ col \              / X \                    /  f/Sx     s  Cx \
| row |  =  CamMat * | Y |   where   CamMat = |     0  f/Sy  Cy |  .
\  1  /              \ 1 /                    \     0     0   1 /

The focal length is denoted by f, Sx,Sy are scaling factors, s describes a skew factor and (Cx,Cy) indicates the principal point. Mainly, these are the elements known from the camera parameters as used for example in calibrate_cameras. Alternatively, the elements of the camera matrix can be described in a different way, see e.g. stationary_camera_self_calibration.

The point correspondences (Rows1,Cols1) and (Rows2,Cols2) are typically found by applying the operator match_essential_matrix_ransac. Multiplying the image coordinates by the inverse of the camera matrices results in the 3D direction vectors, which can then be inserted in the epipolar constraint.

The parameter Method decides whether the relative orientation between the cameras is of a special type and which algorithm is to be applied for its computation. If Method is either 'normalized_dlt' or 'gold_standard' the relative orientation is arbitrary. Choosing 'trans_normalized_dlt' or 'trans_gold_standard' means that the relative motion between the cameras is a pure translation. The typical application for this special motion case is the scenario of a single fixed camera looking onto a moving conveyor belt. In this case the minimum required number of corresponding points is just two instead of six in the general case.

The essential matrix is computed by a linear algorithm if 'normalized_dlt' or 'trans_normalized_dlt' is chosen. With 'gold_standard' or 'trans_gold_standard' the algorithm gives a statistically optimal result. Here, 'normalized_dlt' and 'gold_standard' stand for direct-linear-transformation and gold-standard-algorithm respectively. All methods return the coordinates (X,Y,Z) of the reconstructed 3D points. The optimal methods also return the covariances of the 3D points in CovXYZ. Let n be the number of points then the 3x3 covariance matrices are concatenated and stored in a tuple of length 9n. Additionally, the optimal methods return the covariance of the essential matrix CovEMat.

If an optimal gold-standard-algorithm is chosen the covariances of the image points (CovRR1, CovRC1, CovCC1, CovRR2, CovRC2, CovCC2) can be incorporated in 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 input. 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 process and is the root-mean-square euclidian distance in pixels between the points and their corresponding epipolar lines.

For the operator vector_to_essential_matrix a special configuration of scene points and cameras exists: if all 3D points lie in a single plane and additionally are all closer to one of the two cameras then the solution in the essential matrix is not unique but twofold. As a consequence both solutions are computed and returned by the operator. This means that all output parameters are of double length and the values of the second solution are simply concatenated behind the values of the first one.

Parallelization

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

Parameters

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

Input points in image 1 (row coordinate).

Restriction: length(Rows1) >= 6 || length(Rows1) >= 2

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

Input points in image 1 (column coordinate).

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

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

Input points in image 2 (row coordinate).

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

Cols2 (input_control)  number-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: []

CamMat1 (input_control)  hom_mat2d (real / integer)

Camera matrix of the 1st camera.

CamMat2 (input_control)  hom_mat2d (real / integer)

Camera matrix of the 2nd camera.

Method (input_control)  string (string)

Algorithm for the computation of the essential matrix and for special camera orientations.

Default value: 'normalized_dlt'

List of values: 'gold_standard', 'normalized_dlt', 'trans_gold_standard', 'trans_normalized_dlt'

EMatrix (output_control)  hom_mat2d (real)

Computed essential matrix.

CovEMat (output_control)  real-array (real)

9x9 covariance matrix of the essential matrix.

Error (output_control)  real(-array) (real)

Root-Mean-Square of the epipolar distance error.

X (output_control)  real-array (real)

X coordinates of the reconstructed 3D points.

Y (output_control)  real-array (real)

Y coordinates of the reconstructed 3D points.

Z (output_control)  real-array (real)

Z coordinates of the reconstructed 3D points.

CovXYZ (output_control)  real-array (real)

Covariance matrices of the reconstructed 3D points.