Skip to content

vector_to_proj_hom_mat2d_distortionVectorToProjHomMat2dDistortionVectorToProjHomMat2dDistortionvector_to_proj_hom_mat2d_distortionT_vector_to_proj_hom_mat2d_distortionπŸ”—

Short descriptionπŸ”—

vector_to_proj_hom_mat2d_distortionVectorToProjHomMat2dDistortionVectorToProjHomMat2dDistortionvector_to_proj_hom_mat2d_distortionT_vector_to_proj_hom_mat2d_distortion β€” Compute a projective transformation matrix and the radial distortion coefficient using given image point correspondences.

SignatureπŸ”—

vector_to_proj_hom_mat2d_distortion( point.y Points1Row, point.x Points1Col, point.y Points2Row, point.x Points2Col, number CovRR1, number CovRC1, number CovCC1, number CovRR2, number CovRC2, number CovCC2, integer ImageWidth, integer ImageHeight, string Method, out hom_mat2d HomMat2D, out real Kappa, out real Error )void VectorToProjHomMat2dDistortion( const HTuple& Points1Row, const HTuple& Points1Col, const HTuple& Points2Row, const HTuple& Points2Col, const HTuple& CovRR1, const HTuple& CovRC1, const HTuple& CovCC1, const HTuple& CovRR2, const HTuple& CovRC2, const HTuple& CovCC2, const HTuple& ImageWidth, const HTuple& ImageHeight, const HTuple& Method, HTuple* HomMat2D, HTuple* Kappa, HTuple* Error )static void HOperatorSet.VectorToProjHomMat2dDistortion( HTuple points1Row, HTuple points1Col, HTuple points2Row, HTuple points2Col, HTuple covRR1, HTuple covRC1, HTuple covCC1, HTuple covRR2, HTuple covRC2, HTuple covCC2, HTuple imageWidth, HTuple imageHeight, HTuple method, out HTuple homMat2D, out HTuple kappa, out HTuple error )def vector_to_proj_hom_mat2d_distortion( points_1row: Sequence[Union[float, int]], points_1col: Sequence[Union[float, int]], points_2row: Sequence[Union[float, int]], points_2col: 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]], image_width: int, image_height: int, method: str ) -> Tuple[Sequence[float], float, float]

Herror T_vector_to_proj_hom_mat2d_distortion( const Htuple Points1Row, const Htuple Points1Col, const Htuple Points2Row, const Htuple Points2Col, const Htuple CovRR1, const Htuple CovRC1, const Htuple CovCC1, const Htuple CovRR2, const Htuple CovRC2, const Htuple CovCC2, const Htuple ImageWidth, const Htuple ImageHeight, const Htuple Method, Htuple* HomMat2D, Htuple* Kappa, Htuple* Error )

double HHomMat2D::VectorToProjHomMat2dDistortion( const HTuple& Points1Row, const HTuple& Points1Col, const HTuple& Points2Row, const HTuple& Points2Col, const HTuple& CovRR1, const HTuple& CovRC1, const HTuple& CovCC1, const HTuple& CovRR2, const HTuple& CovRC2, const HTuple& CovCC2, Hlong ImageWidth, Hlong ImageHeight, const HString& Method, double* Error )

double HHomMat2D::VectorToProjHomMat2dDistortion( const HTuple& Points1Row, const HTuple& Points1Col, const HTuple& Points2Row, const HTuple& Points2Col, const HTuple& CovRR1, const HTuple& CovRC1, const HTuple& CovCC1, const HTuple& CovRR2, const HTuple& CovRC2, const HTuple& CovCC2, Hlong ImageWidth, Hlong ImageHeight, const char* Method, double* Error )

double HHomMat2D::VectorToProjHomMat2dDistortion( const HTuple& Points1Row, const HTuple& Points1Col, const HTuple& Points2Row, const HTuple& Points2Col, const HTuple& CovRR1, const HTuple& CovRC1, const HTuple& CovCC1, const HTuple& CovRR2, const HTuple& CovRC2, const HTuple& CovCC2, Hlong ImageWidth, Hlong ImageHeight, const wchar_t* Method, double* Error ) (Windows only)

double HHomMat2D.VectorToProjHomMat2dDistortion( HTuple points1Row, HTuple points1Col, HTuple points2Row, HTuple points2Col, HTuple covRR1, HTuple covRC1, HTuple covCC1, HTuple covRR2, HTuple covRC2, HTuple covCC2, int imageWidth, int imageHeight, string method, out double error )

DescriptionπŸ”—

vector_to_proj_hom_mat2d_distortionVectorToProjHomMat2dDistortion determines the projective transformation matrix HomMat2DhomMat2Dhom_mat_2d and the radial distortion coefficient Kappakappakappa\(\kappa\)) from given point correspondences (Points1Rowpoints1Rowpoints_1row,Points1Colpoints1Colpoints_1col), (Points2Rowpoints2Rowpoints_2row,Points2Colpoints2Colpoints_2col) that optimally fulfill the following equation:

\[\begin{eqnarray*} \left(\begin{array}{c} r_{2} \\ c_{2} \\ 1 \end{array} \right) = \textrm{HomMat2D} \cdot \left(\begin{array}{c} r_{1} \\ c_{1} \\ 1 \end{array} \right). \end{eqnarray*}\]

Here, \((r_{1},c_{1})\) and \((r_{2},c_{2})\) denote image points that are obtained by undistorting the input image points with the division model (see Calibration):

\[\begin{eqnarray*} r = \frac{\tilde{r}}{1+\kappa (\tilde{r}^{2}+\tilde{c}^{2})} \qquad c = \frac{\tilde{c}}{1+\kappa (\tilde{r}^{2}+\tilde{c}^{2})} \end{eqnarray*}\]

Here,

\[\begin{eqnarray*}(\tilde{r}_{1},\tilde{c}_{1}) = (\textrm{Points1Row}-0.5(\textrm{ImageHeight}-1), \textrm{Points1Col}-0.5(\textrm{ImageWidth}-1))\end{eqnarray*}\]

and

\[\begin{eqnarray*}(\tilde{r}_{2},\tilde{c}_{2}) = (\textrm{Points2Row}-0.5(\textrm{ImageHeight}-1), \textrm{Points2Col}-0.5(\textrm{ImageWidth}-1))\end{eqnarray*}\]

denote the distorted image points, specified relative to the image center. Thus, vector_to_proj_hom_mat2d_distortionVectorToProjHomMat2dDistortion assumes that the principal point of the camera, i.e., the center of the radial distortions, lies at the center of the image. Note that the images from which the points (Points1Rowpoints1Rowpoints_1row,Points1Colpoints1Colpoints_1col) and (Points2Rowpoints2Rowpoints_2row,Points2Colpoints2Colpoints_2col) are extracted have to be obtained with the same camera.

The returned Kappakappakappa can be used to construct camera parameters that can be used to rectify images or points (see change_radial_distortion_cam_parChangeRadialDistortionCamPar, change_radial_distortion_imageChangeRadialDistortionImage, and change_radial_distortion_pointsChangeRadialDistortionPoints):

\[\begin{eqnarray*} \texttt{CamPar} & = & ['\textit{area\_scan\_telecentric\_division}', 1.0, \textrm{Kappa}, 1.0, 1.0, 0.5(\textrm{ImageWidth}-1),\\ & & 0.5(\textrm{ImageHeight}-1), \textrm{ImageWidth},\textrm{ImageHeight}] \end{eqnarray*}\]

The minimum number of required point correspondences is five. vector_to_proj_hom_mat2d_distortionVectorToProjHomMat2dDistortion seeks to minimize the transformation error between the point correspondences based on the above equations. To achieve such a minimization, two different algorithms are available. The algorithm to use can be chosen using the parameter Methodmethodmethod. For Methodmethodmethod \(=\) 'linear'"linear", a linear algorithm that minimizes an algebraic error based on the above equations is used. This algorithm is very fast and returns accurate results for small to moderate noise of the point coordinates and for most distortions (except for small distortions). For Methodmethodmethod \(=\) 'gold_standard'"gold_standard", a mathematically optimal but slower optimization is used, which minimizes the geometric reprojection error. In general, it is preferable to use Methodmethodmethod \(=\) 'gold_standard'"gold_standard".

If 'gold_standard'"gold_standard" is used, the covariances of the image points (CovRR1covRR1cov_rr1, CovRC1covRC1cov_rc1, CovCC1covCC1cov_cc1, CovRR2covRR2cov_rr2, CovRC2covRC2cov_rc2, CovCC2covCC2cov_cc2) can be incorporated into 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 passed. In this case, the optimization algorithm internally assumes uniform and equal covariances for all points. If 'linear'"linear" is used, the covariances are ignored and the covariance parameters can be left empty.

The value Errorerrorerror indicates the overall quality of the optimization procedure and is the mean symmetric euclidean distance in pixels between the points and their corresponding transformed points.

If the correspondence between the points has not been determined, proj_match_points_distortion_ransacProjMatchPointsDistortionRansac or proj_match_points_distortion_ransac_guidedProjMatchPointsDistortionRansacGuided should be used to determine the correspondence as well as the transformation.

AttentionπŸ”—

It should be noted that if a homogeneous transformation matrix is used to transform images, regions, XLD contours, or any other data that has been extracted from images, it is assumed that the origin of the coordinate system of the homogeneous transformation matrix lies in the upper left corner of a pixel. The image processing operators that return point coordinates, however, assume a coordinate system in which the origin lies in the center of a pixel. Therefore, to obtain a consistent homogeneous transformation matrix, 0.5 must be added to the point coordinates before computing the transformation.

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πŸ”—

Points1Rowpoints1Rowpoints_1row (input_control) point.y-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(Points1Row) >= 5

Points1Colpoints1Colpoints_1col (input_control) point.x-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(Points1Col) == length(Points1Row)

Points2Rowpoints2Rowpoints_2row (input_control) point.y-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(Points2Row) == length(Points1Row)

Points2Colpoints2Colpoints_2col (input_control) point.x-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(Points2Col) == length(Points1Row)

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: [][]

ImageWidthimageWidthimage_width (input_control) integer β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Width of the images from which the points were extracted.

Restriction: ImageWidth > 0

ImageHeightimageHeightimage_height (input_control) integer β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Height of the images from which the points were extracted.

Restriction: ImageHeight > 0

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

Estimation algorithm.

Default: 'gold_standard'"gold_standard"
List of values: 'gold_standard', 'linear'"gold_standard", "linear"

HomMat2DhomMat2Dhom_mat_2d (output_control) hom_mat2d β†’ (real)HTuple (double)HHomMat2D, HTuple (double)Sequence[float]Htuple (double)

Homogeneous projective transformation matrix.

Kappakappakappa (output_control) real β†’ (real)HTuple (double)HTuple (double)floatHtuple (double)

Computed radial distortion coefficient.

Errorerrorerror (output_control) real β†’ (real)HTuple (double)HTuple (double)floatHtuple (double)

Root-Mean-Square transformation error.

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

proj_match_points_distortion_ransacProjMatchPointsDistortionRansac, proj_match_points_distortion_ransac_guidedProjMatchPointsDistortionRansacGuided, points_foerstnerPointsFoerstner, points_harrisPointsHarris

Possible successors

change_radial_distortion_cam_parChangeRadialDistortionCamPar, change_radial_distortion_imageChangeRadialDistortionImage, change_radial_distortion_pointsChangeRadialDistortionPoints, projective_trans_imageProjectiveTransImage, projective_trans_image_sizeProjectiveTransImageSize, projective_trans_regionProjectiveTransRegion, projective_trans_contour_xldProjectiveTransContourXld, projective_trans_point_2dProjectiveTransPoint2d, projective_trans_pixelProjectiveTransPixel

Alternatives

vector_to_proj_hom_mat2dVectorToProjHomMat2d, hom_vector_to_proj_hom_mat2dHomVectorToProjHomMat2d

See also

calibrate_camerasCalibrateCameras

ReferencesπŸ”—

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

Olivier Faugeras, Quang-Tuan Luong: ``The Geometry of Multiple Images: The Laws That Govern the Formation of Multiple Images of a Scene and Some of Their Applicationsβ€™β€˜; MIT Press, Cambridge, MA; 2001.

ModuleπŸ”—

Calibration