vector_to_hom_mat3d — Approximate a 3D transformation from point correspondences.
vector_to_hom_mat3d approximates an affine or projective 3D transformation from point correspondences and returns it as the homogeneous transformation matrix HomMat3D.
The type of the 3D transformation to compute is specified with TransformationType. For TransformationType = 'rigid', a rigid 3D transformation (a rotation and a translation), for TransformationType = 'similarity', a 3D similarity transformation (a uniform scaling, a rotation, and a translation), for TransformationType = 'affine' a general affine 3D transformation, and for TransformationType = 'projective' a projective 3D transformation is computed.
The minimum required number of point correspondences is 3 for TransformationType = 'rigid', 3 for TransformationType = 'similarity', 4 for TransformationType = 'affine', and 5 for TransformationType = 'projective'.
The point correspondences are passed in the tuples (Px,Py,Pz) and (Qx,Qy,Qz), where corresponding points must be at the same index positions in the tuples. If more than the minimum number of point correspondences are passed, the transformation is overdetermined. In this case, the returned transformation is the transformation that minimizes the distances between the transformed input points (Px,Py,Pz) and the points (Qx,Qy,Qz), as described in the following equation (points as homogeneous vectors):
|| / Qx[i] \ / Px[i] \ ||^2 sum of all || | Qy[i] | - HomMat3D * | Py[i] | || = minimum || | Qz[i] | | Pz[i] | || || \ 1 / \ 1 / ||
HomMat3D can be used directly with operators that transform 3D data using affine transformations, e.g., affine_trans_point_3d.
Type of the transformation to compute.
Default value: 'rigid'
List of values: 'affine', 'projective', 'rigid', 'similarity'
X coordinates of the original points.
Y coordinates of the original points.
Z coordinates of the original points.
X coordinates of the transformed points.
Y coordinates of the transformed points.
Z coordinates of the transformed points.
Output transformation matrix.