美文网首页
scipy.spatial.transform.Rotation

scipy.spatial.transform.Rotation

作者: Koap | 来源:发表于2024-01-31 11:34 被阅读0次

    Rotation类跟欧拉角相关的操作有
    from_euler(seq, angles, degrees=False)
    as_euler(seq, degrees=False)
    两个函数。
    其中,seq=('xyz')seq=('XYZ')含义不同。
    scipy官方文档定义:

    Parameters:
    seq:string
    Specifies sequence of axes for rotations.
    Up to 3 characters belonging to the set {‘X’, ‘Y’, ‘Z’} for intrinsic rotations, or {‘x’, ‘y’, ‘z’} for extrinsic rotations.
    Extrinsic and intrinsic rotations cannot be mixed in one function call.

    即大写字母表示内旋,小写字母表示外旋。

    举例说明:
    相机的外参RT矩阵cam2car,表示了cam坐标系在car坐标系上的位置和旋转关系。
    用cam2car左乘相机坐标系下的点或者向量,即可得到该点或向量在car坐标系下的坐标。
    rot = Rotation.from_matrix(cam2car[:3,:3])
    intrinsic_rot = rot.as_euler('XYZ', degrees=True)
    extrinsic_rot = rot.as_euler('xyz', degrees=True)
    以前视和左前两个相机的外参为例,
    通过上述计算得到:
    前视相机的intrinsic_rot = (0,90,-90), extrinsic_rot = (-90,0,-90)
    左前相机的intrinsic_rot = (-90,32,0), extrinsic_rot = (-90,0,-32)

    IMG_20240201_113147.jpg
    旋转过程如上图所示,由car坐标系出发,经过以上欧拉角的旋转,获得camera坐标系。
    结果符合预期。

    相关文章

      网友评论

          本文标题:scipy.spatial.transform.Rotation

          本文链接:https://www.haomeiwen.com/subject/ctaoodtx.html