def from_rotation_vector ( rot ) : rot = np . array ( rot , copy = False ) quats = np . zeros ( rot . shape [ : - 1 ] + ( 4 , ) ) quats [ ... , 1 : ] = rot [ ... ] / 2 quats = as_quat_array ( quats ) return np . exp ( quats )
python rotation matrix to rotation vector
Convert input 3 - vector in axis - angle representation to unit quaternion
def from_rotation_vector(rot):
    """Convert input 3-vector in axis-angle representation to unit quaternion

    Parameters
    ----------
    rot: (Nx3) float array
        Each vector represents the axis of the rotation, with norm
        proportional to the angle of the rotation in radians.

    Returns
    -------
    q: array of quaternions
        Unit quaternions resulting in rotations corresponding to input
        rotations.  Output shape is rot.shape[:-1].

    """
    rot = np.array(rot, copy=False)
    quats = np.zeros(rot.shape[:-1]+(4,))
    quats[..., 1:] = rot[...]/2
    quats = as_quat_array(quats)
    return np.exp(quats)