ClassesClassesClassesClasses | | | | Operators

hom_mat3d_projectT_hom_mat3d_projectHomMat3dProjecthom_mat3d_projectHomMat3dProjectHomMat3dProject (Operator)

Name

hom_mat3d_projectT_hom_mat3d_projectHomMat3dProjecthom_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)

Herror 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

void HOperatorSetX.HomMat3dProject(
[in] VARIANT HomMat3d, [in] VARIANT PrincipalPointRow, [in] VARIANT PrincipalPointCol, [in] VARIANT Focus, [out] VARIANT* HomMat2d)

IHHomMat2DX* HHomMat3DX.HomMat3dProject(
[in] VARIANT PrincipalPointRow, [in] VARIANT PrincipalPointCol, [in] VARIANT Focus)

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_projectHomMat3dProjecthom_mat3d_projectHomMat3dProjectHomMat3dProject 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_mat2dVectorToProjHomMat2dvector_to_proj_hom_mat2dVectorToProjHomMat2dVectorToProjHomMat2d, hom_vector_to_proj_hom_mat2dhom_vector_to_proj_hom_mat2dHomVectorToProjHomMat2dhom_vector_to_proj_hom_mat2dHomVectorToProjHomMat2dHomVectorToProjHomMat2d, and proj_match_points_ransacproj_match_points_ransacProjMatchPointsRansacproj_match_points_ransacProjMatchPointsRansacProjMatchPointsRansac).

Matrices for rotation, scale, and translation can be constructed using the operators hom_mat3d_identityhom_mat3d_identityHomMat3dIdentityhom_mat3d_identityHomMat3dIdentityHomMat3dIdentity, hom_mat3d_scalehom_mat3d_scaleHomMat3dScalehom_mat3d_scaleHomMat3dScaleHomMat3dScale, hom_mat3d_rotatehom_mat3d_rotateHomMat3dRotatehom_mat3d_rotateHomMat3dRotateHomMat3dRotate, hom_mat3d_translatehom_mat3d_translateHomMat3dTranslatehom_mat3d_translateHomMat3dTranslateHomMat3dTranslate and pose_to_hom_mat3dpose_to_hom_mat3dPoseToHomMat3dpose_to_hom_mat3dPoseToHomMat3dPoseToHomMat3d.

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

The point (PrincipalPointRowPrincipalPointRowPrincipalPointRowPrincipalPointRowPrincipalPointRowprincipalPointRow, PrincipalPointColPrincipalPointColPrincipalPointColPrincipalPointColPrincipalPointColprincipalPointCol) is the principal point of the projection and the point (PrincipalPointRowPrincipalPointRowPrincipalPointRowPrincipalPointRowPrincipalPointRowprincipalPointRow, PrincipalPointColPrincipalPointColPrincipalPointColPrincipalPointColPrincipalPointColprincipalPointCol, 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=FocusFocusFocusFocusFocusfocus, which is FocusFocusFocusFocusFocusfocus pixels away form the camera. As a result, using the identity matrix as the input matrix HomMat3DHomMat3DHomMat3DHomMat3DHomMat3DhomMat3D leads to a matrix HomMat2DHomMat2DHomMat2DHomMat2DHomMat2DhomMat2D which also represents the identity in 2D.

Consequently, the parameter FocusFocusFocusFocusFocusfocus 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)=(PrincipalPointRowPrincipalPointRowPrincipalPointRowPrincipalPointRowPrincipalPointRowprincipalPointRow,PrincipalPointColPrincipalPointColPrincipalPointColPrincipalPointColPrincipalPointColprincipalPointCol) and f=FocusFocusFocusFocusFocusfocus.

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_imageProjectiveTransImageprojective_trans_imageProjectiveTransImageProjectiveTransImage:

The overall transformation can be written as:

Parallelization

Parameters

HomMat3DHomMat3DHomMat3DHomMat3DHomMat3DhomMat3D (input_control)  hom_mat3d HHomMat3D, HTupleHTupleHTupleHHomMat3DX, VARIANTHtuple (real) (double) (double) (double) (double) (double)

3×4 3D transformation matrix.

PrincipalPointRowPrincipalPointRowPrincipalPointRowPrincipalPointRowPrincipalPointRowprincipalPointRow (input_control)  point.y HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Row coordinate of the principal point.

Default value: 256

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

PrincipalPointColPrincipalPointColPrincipalPointColPrincipalPointColPrincipalPointColprincipalPointCol (input_control)  point.x HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Column coordinate of the principal point.

Default value: 256

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

FocusFocusFocusFocusFocusfocus (input_control)  number HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Focal length in pixels.

Default value: 256

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

HomMat2DHomMat2DHomMat2DHomMat2DHomMat2DhomMat2D (output_control)  hom_mat2d HHomMat2D, HTupleHTupleHTupleHHomMat2DX, VARIANTHtuple (real) (double) (double) (double) (double) (double)

Homogeneous projective transformation matrix.

Possible Predecessors

hom_mat3d_identityhom_mat3d_identityHomMat3dIdentityhom_mat3d_identityHomMat3dIdentityHomMat3dIdentity, hom_mat3d_rotatehom_mat3d_rotateHomMat3dRotatehom_mat3d_rotateHomMat3dRotateHomMat3dRotate, hom_mat3d_translatehom_mat3d_translateHomMat3dTranslatehom_mat3d_translateHomMat3dTranslateHomMat3dTranslate, hom_mat3d_scalehom_mat3d_scaleHomMat3dScalehom_mat3d_scaleHomMat3dScaleHomMat3dScale

Possible Successors

projective_trans_imageprojective_trans_imageProjectiveTransImageprojective_trans_imageProjectiveTransImageProjectiveTransImage, projective_trans_point_2dprojective_trans_point_2dProjectiveTransPoint2dprojective_trans_point_2dProjectiveTransPoint2dProjectiveTransPoint2d, projective_trans_regionprojective_trans_regionProjectiveTransRegionprojective_trans_regionProjectiveTransRegionProjectiveTransRegion, projective_trans_contour_xldprojective_trans_contour_xldProjectiveTransContourXldprojective_trans_contour_xldProjectiveTransContourXldProjectiveTransContourXld, hom_mat2d_inverthom_mat2d_invertHomMat2dInverthom_mat2d_invertHomMat2dInvertHomMat2dInvert

Module

Foundation


ClassesClassesClassesClasses | | | | Operators