@@ -1315,6 +1315,21 @@ def delta(self, X2: Optional[SE3] = None) -> R6:
1315
1315
else :
1316
1316
return smb .tr2delta (self .A , X2 .A )
1317
1317
1318
+ def rtvec (self ) -> Tuple [R3 , R3 ]:
1319
+ """
1320
+ Convert to OpenCV-style rotation and translation vectors
1321
+
1322
+ :return: rotation and translation vectors
1323
+ :rtype: ndarray(3), ndarray(3)
1324
+
1325
+ Many OpenCV functions accept pose as two 3-vectors: a rotation vector using
1326
+ exponential coordinates and a translation vector. This method combines them
1327
+ into an SE(3) instance.
1328
+
1329
+ :seealso: :meth:`rtvec`
1330
+ """
1331
+ return SO3 (self ).log (twist = True ), self .t
1332
+
1318
1333
def Ad (self ) -> R6x6 :
1319
1334
r"""
1320
1335
Adjoint of SE(3)
@@ -1856,6 +1871,26 @@ def Exp(cls, S: Union[R6, R4x4], check: bool = True) -> SE3:
1856
1871
else :
1857
1872
return cls (smb .trexp (S ), check = False )
1858
1873
1874
+ @classmethod
1875
+ def RTvec (cls , rvec : ArrayLike3 , tvec : ArrayLike3 ) -> Self :
1876
+ """
1877
+ Construct a new SE(3) from OpenCV-style rotation and translation vectors
1878
+
1879
+ :param rvec: rotation as exponential coordinates
1880
+ :type rvec: ArrayLike3
1881
+ :param tvec: translation vector
1882
+ :type tvec: ArrayLike3
1883
+ :return: An SE(3) instance
1884
+ :rtype: SE3 instance
1885
+
1886
+ Many OpenCV functions (such as pose estimation) return pose as two 3-vectors: a
1887
+ rotation vector using exponential coordinates and a translation vector. This
1888
+ method combines them into an SE(3) instance.
1889
+
1890
+ :seealso: :meth:`rtvec`
1891
+ """
1892
+ return SE3 .Rt (smb .trexp (rvec ), tvec )
1893
+
1859
1894
@classmethod
1860
1895
def Delta (cls , d : ArrayLike6 ) -> SE3 :
1861
1896
r"""
0 commit comments