Rotation類跟歐拉角相關(guān)的操作有
from_euler(seq, angles, degrees=False)
as_euler(seq, degrees=False)
兩個(gè)函數(shù)。
其中,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.
即大寫字母表示內(nèi)旋,小寫字母表示外旋。
舉例說明:
相機(jī)的外參RT矩陣cam2car,表示了cam坐標(biāo)系在car坐標(biāo)系上的位置和旋轉(zhuǎn)關(guān)系。
用cam2car左乘相機(jī)坐標(biāo)系下的點(diǎn)或者向量,即可得到該點(diǎn)或向量在car坐標(biāo)系下的坐標(biāo)。
rot = Rotation.from_matrix(cam2car[:3,:3])
intrinsic_rot = rot.as_euler('XYZ', degrees=True)
extrinsic_rot = rot.as_euler('xyz', degrees=True)
以前視和左前兩個(gè)相機(jī)的外參為例,
通過上述計(jì)算得到:
前視相機(jī)的intrinsic_rot = (0,90,-90), extrinsic_rot = (-90,0,-90)
左前相機(jī)的intrinsic_rot = (-90,32,0), extrinsic_rot = (-90,0,-32)

旋轉(zhuǎn)過程如上圖所示,由car坐標(biāo)系出發(fā),經(jīng)過以上歐拉角的旋轉(zhuǎn),獲得camera坐標(biāo)系。
結(jié)果符合預(yù)期。