pytransform3d.rotations.quaternion_from_matrix

pytransform3d.rotations.quaternion_from_matrix(R, strict_check=True)[source]

Compute quaternion from rotation matrix.

We usually assume active rotations.

Warning

When computing a quaternion from the rotation matrix there is a sign ambiguity: q and -q represent the same rotation.

Parameters
Rarray-like, shape (3, 3)

Rotation matrix

strict_checkbool, optional (default: True)

Raise a ValueError if the rotation matrix is not numerically close enough to a real rotation matrix. Otherwise we print a warning.

Returns
qarray-like, shape (4,)

Unit quaternion to represent rotation: (w, x, y, z)

Examples using pytransform3d.rotations.quaternion_from_matrix