hom_mat3d_projectT_hom_mat3d_projectHomMat3dProjectHomMat3dProject (Operator)

Name

hom_mat3d_projectT_hom_mat3d_projectHomMat3dProjectHomMat3dProject — Project an affine 3D transformation matrix to a 2D projective transformation matrix.

Signature

hom_mat3d_project( : : HomMat3D, PrincipalPointRow, PrincipalPointCol, Focus : HomMat2D)

Herror T_hom_mat3d_project(const Htuple HomMat3D, const Htuple PrincipalPointRow, const Htuple PrincipalPointCol, const Htuple Focus, Htuple* HomMat2D)

void HomMat3dProject(const HTuple& HomMat3D, const HTuple& PrincipalPointRow, const HTuple& PrincipalPointCol, const HTuple& Focus, HTuple* HomMat2D)

HHomMat2D HHomMat3D::HomMat3dProject(const HTuple& PrincipalPointRow, const HTuple& PrincipalPointCol, const HTuple& Focus) const

HHomMat2D HHomMat3D::HomMat3dProject(double PrincipalPointRow, double PrincipalPointCol, double Focus) const

static void HOperatorSet.HomMat3dProject(HTuple homMat3D, HTuple principalPointRow, HTuple principalPointCol, HTuple focus, out HTuple homMat2D)

HHomMat2D HHomMat3D.HomMat3dProject(HTuple principalPointRow, HTuple principalPointCol, HTuple focus)

HHomMat2D HHomMat3D.HomMat3dProject(double principalPointRow, double principalPointCol, double focus)

Description

hom_mat3d_projecthom_mat3d_projectHomMat3dProjectHomMat3dProjectHomMat3dProject calculates a homogeneous projection matrix from a homogeneous 3x4 transformation matrix describing an affine transformation in 3D. The result can be used to project a plane, in particular a plane containing an image. The projection matrix defines a projective transformation between two (two-dimensional) planes.

This can be used to create perspective distortions, which occur in a projection of a plane rotated around an axis other than the z axis. Usually, however, projective transformations are determined from point correspondences (see vector_to_proj_hom_mat2dvector_to_proj_hom_mat2dVectorToProjHomMat2dVectorToProjHomMat2dVectorToProjHomMat2d, hom_vector_to_proj_hom_mat2dhom_vector_to_proj_hom_mat2dHomVectorToProjHomMat2dHomVectorToProjHomMat2dHomVectorToProjHomMat2d, and proj_match_points_ransacproj_match_points_ransacProjMatchPointsRansacProjMatchPointsRansacProjMatchPointsRansac).

Matrices for rotation, scale, and translation can be constructed using the operators hom_mat3d_identityhom_mat3d_identityHomMat3dIdentityHomMat3dIdentityHomMat3dIdentity, hom_mat3d_scalehom_mat3d_scaleHomMat3dScaleHomMat3dScaleHomMat3dScale, hom_mat3d_rotatehom_mat3d_rotateHomMat3dRotateHomMat3dRotateHomMat3dRotate, hom_mat3d_translatehom_mat3d_translateHomMat3dTranslateHomMat3dTranslateHomMat3dTranslate and pose_to_hom_mat3dpose_to_hom_mat3dPoseToHomMat3dPoseToHomMat3dPoseToHomMat3d.

Note that for 3D transformations the x-axis represents the column axis while the y-axis represents the row axis (see also Calibration) while in projective_trans_imageprojective_trans_imageProjectiveTransImageProjectiveTransImageProjectiveTransImage, the first row of HomMat2DHomMat2DHomMat2DHomMat2DhomMat2D contains the transformation of the row axis and the second row contains the transformation of the column axis of the image.

The point (PrincipalPointRowPrincipalPointRowPrincipalPointRowPrincipalPointRowprincipalPointRow, PrincipalPointColPrincipalPointColPrincipalPointColPrincipalPointColprincipalPointCol) is the principal point of the projection and the point (PrincipalPointRowPrincipalPointRowPrincipalPointRowPrincipalPointRowprincipalPointRow, PrincipalPointColPrincipalPointColPrincipalPointColPrincipalPointColprincipalPointCol, 0) can thus be interpreted as the position of the camera in a virtual three-dimensional space. The direction of view is along the positive z-axis.

In this virtual space the plane containing the input image as well as the image plane are located at z=FocusFocusFocusFocusfocus, which is FocusFocusFocusFocusfocus pixels away form the camera. As a result, using the identity matrix as the input matrix HomMat3DHomMat3DHomMat3DHomMat3DhomMat3D leads to a matrix HomMat2DHomMat2DHomMat2DHomMat2DhomMat2D which also represents the identity in 2D.

Consequently, the parameter FocusFocusFocusFocusfocus is the “focal distance” of the virtual camera used and its unit is pixels. Its value influences the degree of perspective distortions. The same input matrix at a bigger focal distance results in weaker distortions than at a low focal distance.

Let H be the affine 3D matrix with elements , (r,c)=(PrincipalPointRowPrincipalPointRowPrincipalPointRowPrincipalPointRowprincipalPointRow,PrincipalPointColPrincipalPointColPrincipalPointColPrincipalPointColprincipalPointCol) and f=FocusFocusFocusFocusfocus.

Then the projective transformation matrix is calculated as follows: First, a 3x4 projection matrix is calculated as:

Since the image of a plane containing points (x, y, f, 1)^T is to be calculated the last two columns of Q can be joined:

Finally, the columns and rows of R are swapped in a way that the first row of P contains the transformation of the row coordinates and the second row contains the transformation of the column coordinates so that P can be used directly in projective_trans_imageprojective_trans_imageProjectiveTransImageProjectiveTransImageProjectiveTransImage:

The overall transformation can be written as:

Execution Information

Parameters

HomMat3DHomMat3DHomMat3DHomMat3DhomMat3D (input_control)  hom_mat3d HHomMat3D, HTupleHTupleHtuple (real) (double) (double) (double)

3×4 3D transformation matrix.

PrincipalPointRowPrincipalPointRowPrincipalPointRowPrincipalPointRowprincipalPointRow (input_control)  point.y HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Row coordinate of the principal point.

Default value: 256

Suggested values: 16, 32, 64, 128, 240, 256, 512

PrincipalPointColPrincipalPointColPrincipalPointColPrincipalPointColprincipalPointCol (input_control)  point.x HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Column coordinate of the principal point.

Default value: 256

Suggested values: 16, 32, 64, 128, 256, 320, 512

FocusFocusFocusFocusfocus (input_control)  number HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Focal length in pixels.

Default value: 256

Suggested values: 1, 2, 5, 256, 32768

HomMat2DHomMat2DHomMat2DHomMat2DhomMat2D (output_control)  hom_mat2d HHomMat2D, HTupleHTupleHtuple (real) (double) (double) (double)

Homogeneous projective transformation matrix.

Possible Predecessors

hom_mat3d_identityhom_mat3d_identityHomMat3dIdentityHomMat3dIdentityHomMat3dIdentity, hom_mat3d_rotatehom_mat3d_rotateHomMat3dRotateHomMat3dRotateHomMat3dRotate, hom_mat3d_translatehom_mat3d_translateHomMat3dTranslateHomMat3dTranslateHomMat3dTranslate, hom_mat3d_scalehom_mat3d_scaleHomMat3dScaleHomMat3dScaleHomMat3dScale

Possible Successors

projective_trans_imageprojective_trans_imageProjectiveTransImageProjectiveTransImageProjectiveTransImage, projective_trans_point_2dprojective_trans_point_2dProjectiveTransPoint2dProjectiveTransPoint2dProjectiveTransPoint2d, projective_trans_regionprojective_trans_regionProjectiveTransRegionProjectiveTransRegionProjectiveTransRegion, projective_trans_contour_xldprojective_trans_contour_xldProjectiveTransContourXldProjectiveTransContourXldProjectiveTransContourXld, hom_mat2d_inverthom_mat2d_invertHomMat2dInvertHomMat2dInvertHomMat2dInvert

Module

Foundation