pose

Representations and conversions of SE(3)

Rigid transformations

We represent rigid transforms as \(4 \times 4\) matrices

\[\begin{equation} \begin{bmatrix} \mathbf R & \mathbf R \mathbf t \\ \mathbf 0 & 1 \end{bmatrix} \in \mathbf{SE}(3) \,, \end{equation}\]

where \(\mathbf R \in \mathbf{SO}(3)\) is a rotation matrix and \(\mathbf t\in \mathbb R^3\) represents a translation.

Tip

In this parameterization, \(\mathbf R \mathbf t\) represents the position of the C-arm source in world coordinates and \(\mathbf R\) represents the orientation of the C-arm.

Note that since rotation matrices are orthogonal (\(\mathbf R \mathbf R^T = \mathbf R^T \mathbf R = \mathbf I\)), we have a simple closed-form equation for the inverse: \[\begin{equation} \begin{bmatrix} \mathbf R & \mathbf R \mathbf t \\ \mathbf 0 & 1 \end{bmatrix}^{-1} = \begin{bmatrix} \mathbf R^T & -\mathbf t \\ \mathbf 0 & 1 \end{bmatrix} \,. \end{equation}\]


source

RigidTransform

 RigidTransform (matrix)

Applies rigid transforms in SE(3) to point clouds. Can handle batched rigid transforms, composition of transforms, closed-form inversion, and conversions to various representations of SE(3).

SE(3) Conversions


source

convert

 convert (*args, parameterization, convention=None)

9D rotation parameterization

SVDO+ (Levinson et al., 2020) use the SVD to symetmetrically orthogonalize a matrix.


source

matrix_to_rotation_9d

 matrix_to_rotation_9d (matrix:torch.Tensor)

source

rotation_9d_to_matrix

 rotation_9d_to_matrix (rotation:torch.Tensor)

Convert a 9-vector to a symmetrically orthogonalized rotation matrix via SVD.

10D rotation parameterizations

Implementations to convert rotation_10d (Peretroukhin et al., 2021) and quaternion_adjugate (Hanson and Hanson, 2022) parameterizations of SO(3) to quaternions.


source

quaternion_to_rotation_10d

 quaternion_to_rotation_10d (q:torch.Tensor)

source

rotation_10d_to_quaternion

 rotation_10d_to_quaternion (rotation:torch.Tensor)

*Convert a 10-vector into a symmetric matrix, whose eigenvector corresponding to the eigenvalue of minimum modulus is the resulting quaternion.

Source: https://arxiv.org/abs/2006.01031*


source

quaternion_to_quaternion_adjugate

 quaternion_to_quaternion_adjugate (q:torch.Tensor)

source

quaternion_adjugate_to_quaternion

 quaternion_adjugate_to_quaternion (rotation:torch.Tensor)

*Convert a 10-vector in the quaternion adjugate, a symmetric matrix whose eigenvector corresponding to the eigenvalue of maximum modulus is the (unnormalized) quaternion. Uses a fast method to solve for the eigenvector without explicity computing the eigendecomposition.

Source: https://arxiv.org/abs/2205.09116*

PyTorch3D conversions port

PyTorch3D has many useful conversion functions for transforming between multiple parameterizations of \(\mathbf{SO}(3)\) and \(\mathbf{SE}(3)\). However, installing PyTorch3D can be annoying for users not on Linux. We include the required conversion functions for PyTorch3D below. The original LICENSE from PyTorch3D is also included:

BSD License

For PyTorch3D software

Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

 * Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.

 * Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

 * Neither the name Meta nor the names of its contributors may be used to
   endorse or promote products derived from this software without specific
   prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.