Herror ::hom_mat3d_to_pose (
    const HTuple &HomMat3D,
    HTuple *Pose
)

Convert homogeneous transformation matrix into 3D pose parameter.

::hom_mat3d_to_pose is used to convert a homogeneous transformation matrix into the correspondent representation of the transformation as translational vector and rotational angles.

The homogeneous 4x3 transformation matrix is given as a tupel HomMat3D in the following order: The first four values describe the first row of the rotation matrix and x-value of the translation vector. The next four values describe the second row of the rotation matrix and the y-value of the translation vector. These are followed by the values of the third row of the rotation matrix and the z-value of the translation vector.

The output tupel Pose describes the external camera parameter by the 3D translational vector (in meters), the three rotation angles and the representation type of the 3D transform. The representation type of a 3D transform generated by ::hom_mat3d_to_pose has Type 1 with code '0'. This means, that the transform of a point is described, hereby the 3D rotation is performed before the 3D translation, that the three rotations are specified as angles (in degrees), and that the rotation order is Gamma-Beta-Alpha, i.e., the first rotation is around the Z-axis, the second one around the new Y-axis, and the third one around the new X-axis, which is generated after the second rotation. This corrensponds to the transformation by homogenous matixes directly. This can be explained by the following holds:


  P_C = (x,y,z) = H*P_W
                
                   (1)         (1)
                = R   * P_W + T
The sense of the other representation types are explained at ::create_pose. With ::convert_pose_type you can convert Pose to every other kind of representation type.

The subsequent program example shows how to generate an appropriate initial camera pose for ::camera_calibration, if the camera pose is roughly measured in the world coordinate system. This is especially important if no planar calibration table (see ::create_caltab) is used and therefore the operator ::find_marks_and_pose cannot be applied. Instead of this natural or artificial landmarks with known world position can be used.

Let for example the relative camera position in the world coordinate system be the following: x = 1.08 m, y = 0.25 m, z = 0.62 m. This means, that the origin of the camera coordinate system in world coordinates has the value [1.08, 0.25, 0.62]. The camera coordinate system is oriented that way, that the line of sight of the camera is along the positive Z-axis. The orientation of the camera coordinate system is given by three rotational angles. In the program example the camera coordinate system is first rotated by 100 degrees around the Z-axis. Subsequently it is rotated by -120 degree around the new (!!!) X-axis. Note that the parameter with the rotation angle in ::hom_mat3d_rotate is negated. This is because the description of a point transfomation and the description of a coordinate system transformation differs in the sign of the rotational angles. See also explanation and example at ::create_pose.


Parameters

HomMat3D (input_control)
affine3d-array -> HTuple.double
Homogeneous transformation matrix.
Number of elements: 12

Pose (output_control)
pose-array -> HTuple.double * / long *
External camera parameters.
Number of elements: 7


Example
HTuple CamParam,StartPose,FinalPose,Errors,Dummy;
HTuple HomMat3DIdent,HomMat3DWorldStart;
HTuple HomMat3DTransX,HomMat3DTransY,HomMat3DTransZ;
HTuple HomMat3DRotX,HomMat3DRotY,HomMat3DRotZ;
HTuple WorldPointsX,WorldPointsY,WorldPointsZ,PixelsRow,PixelsColumn;
// read 3D world points [WorldPointsX,WorldPointsY,WorldPointsZ] 
// extract correspondent 2D image points [PixelsRow,PixelsColumn]
// read internal camera parameters: 
::read_cam_par("campar.dat",&CamParam);
// get rough camera pose from relative camera pose: 
::hom_mat3d_identity(&HomMat3DIdent);
::hom_mat3d_translate(HomMat3DIdent,-1.08,-0.25,-0.62,&HomMat3DTrans);
::hom_mat3d_rotate(HomMat3DTrans,-100.0*3.14159/180.0,"z",0,0,0,
                   &HomMat3DRotZ);
::hom_mat3d_rotate(HomMat3DRotZ,+120.0*3.14159/180.0,"x",0,0,0,
                   &HomMat3DWorldStart);
// convert transformation matrix to pose (rotation and translation)
::hom_mat3d_to_pose(HomMat3DWorldStart,&StartPose);
// calibration of external camera params:
::camera_calibration(WorldPointsX,WorldPointsY,WorldPointsZ,
                     PixelsRow,PixelsColumn,CamParam,StartPose,6,
                     &Dummy,&FinalPose,&Errors);

Result

::hom_mat3d_to_pose returns H_MSG_TRUE if all parameter values are correct. If necessary, an exception handling is raised


Possible Predecessors

::hom_mat3d_rotate, ::hom_mat3d_translate, ::hom_mat3d_invert


Possible Successors

::camera_calibration, ::write_pose, ::disp_caltab, ::sim_caltab


See also

::create_pose, ::camera_calibration, ::disp_caltab, ::sim_caltab, ::write_pose, ::read_pose, ::pose_to_hom_mat3d, ::project_3d_point, ::get_line_of_sight, ::hom_mat3d_rotate, ::hom_mat3d_translate, ::hom_mat3d_invert, ::affine_trans_point_3d


Module

Camera calibration



Copyright © 1996-2002 MVTec Software GmbH