Skip to content

hom_mat2d_to_affine_parHomMat2dToAffineParHomMat2dToAffineParhom_mat2d_to_affine_parT_hom_mat2d_to_affine_par🔗

Short description🔗

hom_mat2d_to_affine_parHomMat2dToAffineParHomMat2dToAffineParhom_mat2d_to_affine_parT_hom_mat2d_to_affine_par — Compute the affine transformation parameters from a homogeneous 2D transformation matrix.

Signature🔗

hom_mat2d_to_affine_par( hom_mat2d HomMat2D, out real Sx, out real Sy, out angle.rad Phi, out angle.rad Theta, out point.x Tx, out point.y Ty )void HomMat2dToAffinePar( const HTuple& HomMat2D, HTuple* Sx, HTuple* Sy, HTuple* Phi, HTuple* Theta, HTuple* Tx, HTuple* Ty )static void HOperatorSet.HomMat2dToAffinePar( HTuple homMat2D, out HTuple sx, out HTuple sy, out HTuple phi, out HTuple theta, out HTuple tx, out HTuple ty )def hom_mat2d_to_affine_par( hom_mat_2d: Sequence[float] ) -> Tuple[float, float, float, float, float, float]

Herror T_hom_mat2d_to_affine_par( const Htuple HomMat2D, Htuple* Sx, Htuple* Sy, Htuple* Phi, Htuple* Theta, Htuple* Tx, Htuple* Ty )

double HHomMat2D::HomMat2dToAffinePar( double* Sy, double* Phi, double* Theta, double* Tx, double* Ty ) const

double HHomMat2D.HomMat2dToAffinePar( out double sy, out double phi, out double theta, out double tx, out double ty )

Description🔗

hom_mat2d_to_affine_parHomMat2dToAffinePar computes the affine transformation parameters corresponding to the homogeneous 2D transformation matrix HomMat2DhomMat2Dhom_mat_2d. The parameters Sxsxsx and Sysysy determine how the transformation scales the original x- and y-axes, respectively. The two scaling factors are always positive. The angle Thetathetatheta describes whether the transformed coordinate axes are orthogonal (Thetathetatheta = 0) or slanted. If \(|\textrm{Theta}| > \pi/2\), the transformation contains a reflection. The angle Phiphiphi determines the rotation of the transformed x-axis with respect to the original x-axis. The parameters Txtxtx and Tytyty determine the translation of the two coordinate systems. The matrix HomMat2DhomMat2Dhom_mat_2d can be constructed from the six transformation parameters by the following operator sequence:

 
hom_mat2d_identity(HomMat2DIdentity)HomMat2dIdentity(HomMat2DIdentity)HomMat2dIdentity(HomMat2DIdentity)hom_mat2d_identity(HomMat2DIdentity)hom_mat2d_identity(HomMat2DIdentity)
hom_mat2d_scale(HomMat2DIdentity, Sx, Sy, 0, 0, HomMat2DScale)HomMat2dScale(HomMat2DIdentity, Sx, Sy, 0, 0, HomMat2DScale)HomMat2dScale(HomMat2DIdentity, Sx, Sy, 0, 0, HomMat2DScale)hom_mat2d_scale(HomMat2DIdentity, Sx, Sy, 0, 0, HomMat2DScale)hom_mat2d_scale(HomMat2DIdentity, Sx, Sy, 0, 0, HomMat2DScale)
hom_mat2d_slant(HomMat2DScale, Theta, 'y', 0, 0, HomMat2DSlant)HomMat2dSlant(HomMat2DScale, Theta, "y", 0, 0, HomMat2DSlant)HomMat2dSlant(HomMat2DScale, Theta, "y", 0, 0, HomMat2DSlant)hom_mat2d_slant(HomMat2DScale, Theta, "y", 0, 0, HomMat2DSlant)hom_mat2d_slant(HomMat2DScale, Theta, "y", 0, 0, HomMat2DSlant)
hom_mat2d_rotate(HomMat2DSlant, Phi, 0, 0, HomMat2DRotate)HomMat2dRotate(HomMat2DSlant, Phi, 0, 0, HomMat2DRotate)HomMat2dRotate(HomMat2DSlant, Phi, 0, 0, HomMat2DRotate)hom_mat2d_rotate(HomMat2DSlant, Phi, 0, 0, HomMat2DRotate)hom_mat2d_rotate(HomMat2DSlant, Phi, 0, 0, HomMat2DRotate)
hom_mat2d_translate(HomMat2DRotate, Tx, Ty, HomMat2D)HomMat2dTranslate(HomMat2DRotate, Tx, Ty, HomMat2D)HomMat2dTranslate(HomMat2DRotate, Tx, Ty, HomMat2D)hom_mat2d_translate(HomMat2DRotate, Tx, Ty, HomMat2D)hom_mat2d_translate(HomMat2DRotate, Tx, Ty, HomMat2D)

This is equivalent to the following chain of transformation matrices:

\[\begin{eqnarray*} \textrm{HomMat2D} = \mvHomMatrixTwoDElements{1 & 0 & + \textrm{Tx} \\ 0 & 1 & + \textrm{Ty}} \cdot \mvHomMatrixTwoDElements{\cos(\textrm{Phi}) & - \sin(\textrm{Phi}) & 0 \\ \sin(\textrm{Phi}) & \cos(\textrm{Phi}) & 0} \cdot \mvHomMatrixTwoDElements{1 & - \sin(\textrm{Theta}) & 0 \\ 0 & \cos(\textrm{Theta}) & 0} \cdot \mvHomMatrixTwoDElements{\textrm{Sx} & 0 & 0 \\ 0 & \textrm{Sy} & 0} \end{eqnarray*}\]

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🔗

HomMat2DhomMat2Dhom_mat_2d (input_control) hom_mat2d → (real)HTuple (double)HHomMat2D, HTuple (double)Sequence[float]Htuple (double)

Input transformation matrix.

Sxsxsx (output_control) real → (real)HTuple (double)HTuple (double)floatHtuple (double)

Scaling factor along the x direction.

Sysysy (output_control) real → (real)HTuple (double)HTuple (double)floatHtuple (double)

Scaling factor along the y direction.

Phiphiphi (output_control) angle.rad → (real)HTuple (double)HTuple (double)floatHtuple (double)

Rotation angle.

Thetathetatheta (output_control) angle.rad → (real)HTuple (double)HTuple (double)floatHtuple (double)

Slant angle.

Txtxtx (output_control) point.x → (real)HTuple (double)HTuple (double)floatHtuple (double)

Translation along the x direction.

Tytyty (output_control) point.y → (real)HTuple (double)HTuple (double)floatHtuple (double)

Translation along the y direction.

Result🔗

If the matrix HomMat2DhomMat2Dhom_mat_2d is non-degenerate and represents an affine transformation (i.e., not a projective transformation), hom_mat2d_to_affine_parHomMat2dToAffinePar returns 2 (H_MSG_TRUE). Otherwise, an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

vector_to_hom_mat2dVectorToHomMat2d, vector_to_rigidVectorToRigid, vector_to_similarityVectorToSimilarity, vector_to_anisoVectorToAniso, point_line_to_hom_mat2dPointLineToHomMat2d

Possible successors

hom_mat2d_translateHomMat2dTranslate, hom_mat2d_scaleHomMat2dScale, hom_mat2d_rotateHomMat2dRotate, hom_mat2d_slantHomMat2dSlant

Module🔗

Foundation