Skip to content

vector_to_rel_poseVectorToRelPoseVectorToRelPosevector_to_rel_poseT_vector_to_rel_poseπŸ”—

Short descriptionπŸ”—

vector_to_rel_poseVectorToRelPoseVectorToRelPosevector_to_rel_poseT_vector_to_rel_pose β€” Compute the relative orientation between two cameras given image point correspondences and known camera parameters and reconstruct 3D space points.

SignatureπŸ”—

vector_to_rel_pose( number Rows1, number Cols1, number Rows2, number Cols2, number CovRR1, number CovRC1, number CovCC1, number CovRR2, number CovRC2, number CovCC2, campar CamPar1, campar CamPar2, string Method, out pose RelPose, out real CovRelPose, out real Error, out real X, out real Y, out real Z, out real CovXYZ )void VectorToRelPose( const HTuple& Rows1, const HTuple& Cols1, const HTuple& Rows2, const HTuple& Cols2, const HTuple& CovRR1, const HTuple& CovRC1, const HTuple& CovCC1, const HTuple& CovRR2, const HTuple& CovRC2, const HTuple& CovCC2, const HTuple& CamPar1, const HTuple& CamPar2, const HTuple& Method, HTuple* RelPose, HTuple* CovRelPose, HTuple* Error, HTuple* X, HTuple* Y, HTuple* Z, HTuple* CovXYZ )static void HOperatorSet.VectorToRelPose( HTuple rows1, HTuple cols1, HTuple rows2, HTuple cols2, HTuple covRR1, HTuple covRC1, HTuple covCC1, HTuple covRR2, HTuple covRC2, HTuple covCC2, HTuple camPar1, HTuple camPar2, HTuple method, out HTuple relPose, out HTuple covRelPose, out HTuple error, out HTuple x, out HTuple y, out HTuple z, out HTuple covXYZ )def vector_to_rel_pose( rows_1: Sequence[Union[float, int]], cols_1: Sequence[Union[float, int]], rows_2: Sequence[Union[float, int]], cols_2: Sequence[Union[float, int]], cov_rr1: Sequence[Union[float, int]], cov_rc1: Sequence[Union[float, int]], cov_cc1: Sequence[Union[float, int]], cov_rr2: Sequence[Union[float, int]], cov_rc2: Sequence[Union[float, int]], cov_cc2: Sequence[Union[float, int]], cam_par_1: Sequence[Union[float, int, str]], cam_par_2: Sequence[Union[float, int, str]], method: str ) -> Tuple[Sequence[Union[int, float]], Sequence[float], Sequence[float], Sequence[float], Sequence[float], Sequence[float], Sequence[float]]

def vector_to_rel_pose_s( rows_1: Sequence[Union[float, int]], cols_1: Sequence[Union[float, int]], rows_2: Sequence[Union[float, int]], cols_2: Sequence[Union[float, int]], cov_rr1: Sequence[Union[float, int]], cov_rc1: Sequence[Union[float, int]], cov_cc1: Sequence[Union[float, int]], cov_rr2: Sequence[Union[float, int]], cov_rc2: Sequence[Union[float, int]], cov_cc2: Sequence[Union[float, int]], cam_par_1: Sequence[Union[float, int, str]], cam_par_2: Sequence[Union[float, int, str]], method: str ) -> Tuple[Sequence[Union[int, float]], Sequence[float], float, Sequence[float], Sequence[float], Sequence[float], Sequence[float]]Herror T_vector_to_rel_pose( const Htuple Rows1, const Htuple Cols1, const Htuple Rows2, const Htuple Cols2, const Htuple CovRR1, const Htuple CovRC1, const Htuple CovCC1, const Htuple CovRR2, const Htuple CovRC2, const Htuple CovCC2, const Htuple CamPar1, const Htuple CamPar2, const Htuple Method, Htuple* RelPose, Htuple* CovRelPose, Htuple* Error, Htuple* X, Htuple* Y, Htuple* Z, Htuple* CovXYZ )

HPose HCamPar::VectorToRelPose( const HTuple& Rows1, const HTuple& Cols1, const HTuple& Rows2, const HTuple& Cols2, const HTuple& CovRR1, const HTuple& CovRC1, const HTuple& CovCC1, const HTuple& CovRR2, const HTuple& CovRC2, const HTuple& CovCC2, const HCamPar& CamPar2, const HString& Method, HTuple* CovRelPose, HTuple* Error, HTuple* X, HTuple* Y, HTuple* Z, HTuple* CovXYZ ) const

HPose HCamPar::VectorToRelPose( const HTuple& Rows1, const HTuple& Cols1, const HTuple& Rows2, const HTuple& Cols2, const HTuple& CovRR1, const HTuple& CovRC1, const HTuple& CovCC1, const HTuple& CovRR2, const HTuple& CovRC2, const HTuple& CovCC2, const HCamPar& CamPar2, const HString& Method, HTuple* CovRelPose, double* Error, HTuple* X, HTuple* Y, HTuple* Z, HTuple* CovXYZ ) const

HPose HCamPar::VectorToRelPose( const HTuple& Rows1, const HTuple& Cols1, const HTuple& Rows2, const HTuple& Cols2, const HTuple& CovRR1, const HTuple& CovRC1, const HTuple& CovCC1, const HTuple& CovRR2, const HTuple& CovRC2, const HTuple& CovCC2, const HCamPar& CamPar2, const char* Method, HTuple* CovRelPose, double* Error, HTuple* X, HTuple* Y, HTuple* Z, HTuple* CovXYZ ) const

HPose HCamPar::VectorToRelPose( const HTuple& Rows1, const HTuple& Cols1, const HTuple& Rows2, const HTuple& Cols2, const HTuple& CovRR1, const HTuple& CovRC1, const HTuple& CovCC1, const HTuple& CovRR2, const HTuple& CovRC2, const HTuple& CovCC2, const HCamPar& CamPar2, const wchar_t* Method, HTuple* CovRelPose, double* Error, HTuple* X, HTuple* Y, HTuple* Z, HTuple* CovXYZ ) const (Windows only)

HTuple HPose::VectorToRelPose( const HTuple& Rows1, const HTuple& Cols1, const HTuple& Rows2, const HTuple& Cols2, const HTuple& CovRR1, const HTuple& CovRC1, const HTuple& CovCC1, const HTuple& CovRR2, const HTuple& CovRC2, const HTuple& CovCC2, const HCamPar& CamPar1, const HCamPar& CamPar2, const HString& Method, HTuple* Error, HTuple* X, HTuple* Y, HTuple* Z, HTuple* CovXYZ )

HTuple HPose::VectorToRelPose( const HTuple& Rows1, const HTuple& Cols1, const HTuple& Rows2, const HTuple& Cols2, const HTuple& CovRR1, const HTuple& CovRC1, const HTuple& CovCC1, const HTuple& CovRR2, const HTuple& CovRC2, const HTuple& CovCC2, const HCamPar& CamPar1, const HCamPar& CamPar2, const HString& Method, double* Error, HTuple* X, HTuple* Y, HTuple* Z, HTuple* CovXYZ )

HTuple HPose::VectorToRelPose( const HTuple& Rows1, const HTuple& Cols1, const HTuple& Rows2, const HTuple& Cols2, const HTuple& CovRR1, const HTuple& CovRC1, const HTuple& CovCC1, const HTuple& CovRR2, const HTuple& CovRC2, const HTuple& CovCC2, const HCamPar& CamPar1, const HCamPar& CamPar2, const char* Method, double* Error, HTuple* X, HTuple* Y, HTuple* Z, HTuple* CovXYZ )

HTuple HPose::VectorToRelPose( const HTuple& Rows1, const HTuple& Cols1, const HTuple& Rows2, const HTuple& Cols2, const HTuple& CovRR1, const HTuple& CovRC1, const HTuple& CovCC1, const HTuple& CovRR2, const HTuple& CovRC2, const HTuple& CovCC2, const HCamPar& CamPar1, const HCamPar& CamPar2, const wchar_t* Method, double* Error, HTuple* X, HTuple* Y, HTuple* Z, HTuple* CovXYZ ) (Windows only)

HPose HCamPar.VectorToRelPose( HTuple rows1, HTuple cols1, HTuple rows2, HTuple cols2, HTuple covRR1, HTuple covRC1, HTuple covCC1, HTuple covRR2, HTuple covRC2, HTuple covCC2, HCamPar camPar2, string method, out HTuple covRelPose, out HTuple error, out HTuple x, out HTuple y, out HTuple z, out HTuple covXYZ )

HPose HCamPar.VectorToRelPose( HTuple rows1, HTuple cols1, HTuple rows2, HTuple cols2, HTuple covRR1, HTuple covRC1, HTuple covCC1, HTuple covRR2, HTuple covRC2, HTuple covCC2, HCamPar camPar2, string method, out HTuple covRelPose, out double error, out HTuple x, out HTuple y, out HTuple z, out HTuple covXYZ )

HTuple HPose.VectorToRelPose( HTuple rows1, HTuple cols1, HTuple rows2, HTuple cols2, HTuple covRR1, HTuple covRC1, HTuple covCC1, HTuple covRR2, HTuple covRC2, HTuple covCC2, HCamPar camPar1, HCamPar camPar2, string method, out HTuple error, out HTuple x, out HTuple y, out HTuple z, out HTuple covXYZ )

HTuple HPose.VectorToRelPose( HTuple rows1, HTuple cols1, HTuple rows2, HTuple cols2, HTuple covRR1, HTuple covRC1, HTuple covCC1, HTuple covRR2, HTuple covRC2, HTuple covCC2, HCamPar camPar1, HCamPar camPar2, string method, out double error, out HTuple x, out HTuple y, out HTuple z, out HTuple covXYZ )

DescriptionπŸ”—

For a stereo configuration with known camera parameters the geometric relation between the two images is defined by the relative pose. The operator vector_to_rel_poseVectorToRelPose computes the relative pose from in general at least six point correspondences in the image pair. RelPoserelPoserel_pose indicates the relative pose of camera 1 with respect to camera 2 (see create_poseCreatePose for more information about poses and their representations.). This is in accordance with the explicit calibration of a stereo setup using the operator calibrate_camerasCalibrateCameras. Now, let R,t be the rotation and translation of the relative pose. Then, the essential matrix E is defined as \(E=([t]_{\times} R)^T\), where \([t]_{\times}\) denotes the 3x3 skew-symmetric matrix realizing the cross product with the vector t. The pose can be determined from the epipolar constraint:

\[\begin{eqnarray*} \left(\begin{array}{c} X_{2} \\ Y_{2} \\ 1 \end{array} \right)^T \cdot ([t]_{\times} R)^T \cdot \left(\begin{array}{c} X_{1} \\ Y_{1} \\ 1 \end{array} \right) = 0 \quad \textrm{where} \quad [t]_{\times} = \left(\begin{array}{ccc} 0 & -t_{z} & t_{y} \\ t_{z} & 0 & -t_{x} \\ -t_{y} & t_{x} & 0 \\ \end{array} \right) \quad . \end{eqnarray*}\]

Note, that the essential matrix is a projective entity and thus is defined up to a scaling factor. From this follows that the translation vector of the relative pose can only be determined up to scale too. In fact, the computed translation vector will always be normalized to unit length. As a consequence, a three-dimensional reconstruction of the scene, here in terms of points given by their coordinates (Xxx,Yyy,Zzz), can be carried out only up to a single global scaling factor. If the absolute 3D coordinates of the reconstruction are to be achieved the unknown scaling factor can be computed from a gauge, which has to be visible in both images. For example, a simple gauge can be given by any known distance between points in the scene.

The operator vector_to_rel_poseVectorToRelPose is designed to deal with a camera model that includes lens distortions. This is in contrast to the operator vector_to_essential_matrixVectorToEssentialMatrix, which encompasses only straight line preserving cameras. The camera parameters are passed by the arguments CamPar1camPar1cam_par_1, CamPar2camPar2cam_par_2. The 3D direction vectors \((X_{1},Y_{1},1)\) and \((X_{2},Y_{2},1)\) are calculated from the point coordinates (Rows1rows1rows_1,Cols1cols1cols_1) and (Rows2rows2rows_2,Cols2cols2cols_2) by inverting the process of projection (see Calibration). The point correspondences are typically determined by applying the operator match_rel_pose_ransacMatchRelPoseRansac.

The parameter Methodmethodmethod decides whether the relative orientation between the cameras is of a special type and which algorithm is to be applied for its computation. If Methodmethodmethod is either 'normalized_dlt'"normalized_dlt" or 'gold_standard'"gold_standard" the relative orientation is arbitrary. Choosing 'trans_normalized_dlt'"trans_normalized_dlt" or 'trans_gold_standard'"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 relative pose is computed by a linear algorithm if 'normalized_dlt'"normalized_dlt" or 'trans_normalized_dlt'"trans_normalized_dlt" is chosen. With 'gold_standard'"gold_standard" or 'trans_gold_standard'"trans_gold_standard" the algorithm gives a statistically optimal result. Here, 'normalized_dlt'"normalized_dlt" and 'gold_standard'"gold_standard" stand for direct-linear-transformation and gold-standard-algorithm respectively. All methods return the coordinates (Xxx,Yyy,Zzz) of the reconstructed 3D points. The optimal methods also return the covariances of the 3D points in CovXYZcovXYZcov_xyz. 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 6x6 covariance matrix of the pose CovRelPosecovRelPosecov_rel_pose.

If an optimal gold-standard-algorithm is chosen the covariances of the image points (CovRR1covRR1cov_rr1, CovRC1covRC1cov_rc1, CovCC1covCC1cov_cc1, CovRR2covRR2cov_rr2, CovRC2covRC2cov_rc2, CovCC2covCC2cov_cc2) can be incorporated in the computation. They can be provided for example by the operator points_foerstnerPointsFoerstner. 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 Errorerrorerror indicates the overall quality of the optimization process and is the root-mean-square Euclidean distance in pixels between the points and their corresponding epipolar lines.

For the operator vector_to_rel_poseVectorToRelPose 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 relative pose 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.

Execution informationπŸ”—

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

ParametersπŸ”—

Rows1rows1rows_1 (input_control) number-array β†’ (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Sequence[Union[float, int]]Htuple (double / Hlong)

Input points in image 1 (row coordinate).

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

Cols1cols1cols_1 (input_control) number-array β†’ (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Sequence[Union[float, int]]Htuple (double / Hlong)

Input points in image 1 (column coordinate).

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

Rows2rows2rows_2 (input_control) number-array β†’ (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Sequence[Union[float, int]]Htuple (double / Hlong)

Input points in image 2 (row coordinate).

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

Cols2cols2cols_2 (input_control) number-array β†’ (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Sequence[Union[float, int]]Htuple (double / Hlong)

Input points in image 2 (column coordinate).

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

CovRR1covRR1cov_rr1 (input_control) number-array β†’ (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Sequence[Union[float, int]]Htuple (double / Hlong)

Row coordinate variance of the points in image 1.

Default: [][]

CovRC1covRC1cov_rc1 (input_control) number-array β†’ (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Sequence[Union[float, int]]Htuple (double / Hlong)

Covariance of the points in image 1.

Default: [][]

CovCC1covCC1cov_cc1 (input_control) number-array β†’ (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Sequence[Union[float, int]]Htuple (double / Hlong)

Column coordinate variance of the points in image 1.

Default: [][]

CovRR2covRR2cov_rr2 (input_control) number-array β†’ (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Sequence[Union[float, int]]Htuple (double / Hlong)

Row coordinate variance of the points in image 2.

Default: [][]

CovRC2covRC2cov_rc2 (input_control) number-array β†’ (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Sequence[Union[float, int]]Htuple (double / Hlong)

Covariance of the points in image 2.

Default: [][]

CovCC2covCC2cov_cc2 (input_control) number-array β†’ (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Sequence[Union[float, int]]Htuple (double / Hlong)

Column coordinate variance of the points in image 2.

Default: [][]

CamPar1camPar1cam_par_1 (input_control) campar β†’ (real / integer / string)HTuple (double / Hlong / HString)HCamPar, HTuple (double / int / long / string)Sequence[Union[float, int, str]]Htuple (double / Hlong / char*)

Camera parameters of the 1st camera.

CamPar2camPar2cam_par_2 (input_control) campar β†’ (real / integer / string)HTuple (double / Hlong / HString)HCamPar, HTuple (double / int / long / string)Sequence[Union[float, int, str]]Htuple (double / Hlong / char*)

Camera parameters of the 2nd camera.

Methodmethodmethod (input_control) string β†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

Algorithm for the computation of the relative pose and for special pose types.

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

RelPoserelPoserel_pose (output_control) pose β†’ (real / integer)HTuple (double / Hlong)HPose, HTuple (double / int / long)Sequence[Union[int, float]]Htuple (double / Hlong)

Computed relative orientation of the cameras (3D pose).

CovRelPosecovRelPosecov_rel_pose (output_control) real-array β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

6x6 covariance matrix of the relative camera orientation.

Errorerrorerror (output_control) real(-array) β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Root-Mean-Square of the epipolar distance error.

Xxx (output_control) real-array β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

X coordinates of the reconstructed 3D points.

Yyy (output_control) real-array β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Y coordinates of the reconstructed 3D points.

Zzz (output_control) real-array β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Z coordinates of the reconstructed 3D points.

CovXYZcovXYZcov_xyz (output_control) real-array β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Covariance matrices of the reconstructed 3D points.

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

match_rel_pose_ransacMatchRelPoseRansac

Possible successors

gen_binocular_rectification_mapGenBinocularRectificationMap, rel_pose_to_fundamental_matrixRelPoseToFundamentalMatrix

Alternatives

vector_to_essential_matrixVectorToEssentialMatrix, vector_to_fundamental_matrixVectorToFundamentalMatrix, binocular_calibrationBinocularCalibration

See also

camera_calibrationCameraCalibration

ReferencesπŸ”—

Richard Hartley, Andrew Zisserman: ``Multiple View Geometry in Computer Visionβ€™β€˜; Cambridge University Press, Cambridge; 2003.

J.Chris McGlone (editor): β€œManual of Photogrammetry”; American Society for Photogrammetry and Remote Sensing ; 2004.

ModuleπŸ”—

3D Metrology