Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

rename relative/compose transforms to boxplus/boxminus

edgarriba3015139f4926
diff --git a/test/test_transformations.py b/test/test_transformations.py
index 2a2da7912..6f640fc58 100644
--- a/test/test_transformations.py
+++ b/test/test_transformations.py
@@ -90,7 +90,7 @@ class TestComposeTransforms:
trans_12 = identity_matrix(batch_size=1)[0]
trans_12[..., :3, -1] += offset # add offset to translation vector
- trans_02 = tgm.compose_transformations(trans_01, trans_12)
+ trans_02 = tgm.boxplus_transformation(trans_01, trans_12)
assert utils.check_equal_torch(trans_02, trans_12)
@pytest.mark.parametrize("batch_size", [1, 2, 5])
@@ -100,7 +100,7 @@ class TestComposeTransforms:
trans_12 = identity_matrix(batch_size)
trans_12[..., :3, -1] += offset # add offset to translation vector
- trans_02 = tgm.compose_transformations(trans_01, trans_12)
+ trans_02 = tgm.boxplus_transformation(trans_01, trans_12)
assert utils.check_equal_torch(trans_02, trans_12)
@pytest.mark.parametrize("batch_size", [1, 2, 5])
@@ -110,7 +110,7 @@ class TestComposeTransforms:
trans_01 = utils.tensor_to_gradcheck_var(trans_01) # to var
trans_12 = utils.tensor_to_gradcheck_var(trans_12) # to var
- assert gradcheck(tgm.compose_transformations, (trans_01, trans_12,),
+ assert gradcheck(tgm.boxplus_transformation, (trans_01, trans_12,),
raise_exception=True)
@@ -166,8 +166,8 @@ class TestRelativeTransformation:
trans_02 = identity_matrix(batch_size=1)[0]
trans_02[..., :3, -1] += offset # add offset to translation vector
- trans_12 = tgm.relative_transformation(trans_01, trans_02)
- trans_02_hat = tgm.compose_transformations(trans_01, trans_12)
+ trans_12 = tgm.boxminus_transformation(trans_01, trans_02)
+ trans_02_hat = tgm.boxplus_transformation(trans_01, trans_12)
assert utils.check_equal_torch(trans_02_hat, trans_02)
@pytest.mark.parametrize("batch_size", [1, 2, 5])
@@ -182,8 +182,8 @@ class TestRelativeTransformation:
trans_02[..., :3, -1] += offset # add offset to translation vector
trans_02[..., :3, :3] = rmat_02[..., :3, :3]
- trans_12 = tgm.relative_transformation(trans_01, trans_02)
- trans_02_hat = tgm.compose_transformations(trans_01, trans_12)
+ trans_12 = tgm.boxminus_transformation(trans_01, trans_02)
+ trans_02_hat = tgm.boxplus_transformation(trans_01, trans_12)
assert utils.check_equal_torch(trans_02_hat, trans_02)
@pytest.mark.parametrize("batch_size", [1, 2, 5])
@@ -193,5 +193,5 @@ class TestRelativeTransformation:
trans_01 = utils.tensor_to_gradcheck_var(trans_01) # to var
trans_02 = utils.tensor_to_gradcheck_var(trans_02) # to var
- assert gradcheck(tgm.relative_transformation, (trans_01, trans_02,),
+ assert gradcheck(tgm.boxminus_transformation, (trans_01, trans_02,),
raise_exception=True)
diff --git a/torchgeometry/core/depth_warper.py b/torchgeometry/core/depth_warper.py
index 284695ca4..a54eade85 100644
--- a/torchgeometry/core/depth_warper.py
+++ b/torchgeometry/core/depth_warper.py
@@ -4,7 +4,7 @@ import torch.nn as nn
import torch.nn.functional as F
from torchgeometry.core.transformations import transform_points
-from torchgeometry.core.transformations import relative_transformation
+from torchgeometry.core.transformations import boxminus_transformation
from torchgeometry.core.conversions import convert_points_to_homogeneous
from torchgeometry.core.pinhole import PinholeCamera, PinholeCamerasList
from torchgeometry.core.pinhole import normalize_pixel_coordinates
@@ -76,7 +76,7 @@ class DepthWarper(nn.Module):
"PinholeCamera. Got {}".format(type(pinhole_src)))
# compute the relative pose between the non reference and the reference
# camera frames.
- dst_trans_src: torch.Tensor = relative_transformation(
+ dst_trans_src: torch.Tensor = boxminus_transformation(
pinhole_src.extrinsics, self._pinhole_dst.extrinsics)
# compute the projection matrix between the non reference cameras and
diff --git a/torchgeometry/core/transformations.py b/torchgeometry/core/transformations.py
index c306c3f35..af2faccdb 100644
--- a/torchgeometry/core/transformations.py
+++ b/torchgeometry/core/transformations.py
@@ -8,15 +8,15 @@ from torchgeometry.core.conversions import convert_points_from_homogeneous
__all__ = [
- "compose_transformations",
+ "boxplus_transformation",
+ "boxminus_transformation",
"inverse_transformation",
- "relative_transformation",
"transform_points",
"TransformPoints",
]
-def compose_transformations(
+def boxplus_transformation(
trans_01: torch.Tensor, trans_12: torch.Tensor) -> torch.Tensor:
r"""Functions that composes two homogeneous transformations.
@@ -125,7 +125,7 @@ def inverse_transformation(trans_12):
return trans_21
-def relative_transformation(
+def boxminus_transformation(
trans_01: torch.Tensor, trans_02: torch.Tensor) -> torch.Tensor:
r"""Function that computes the relative homogenous transformation from a
reference transformation :math:`T_1^{0} = \begin{bmatrix} R_1 & t_1 \\
@@ -171,7 +171,7 @@ def relative_transformation(
raise ValueError("Input number of dims must match. Got {} and {}"
.format(trans_01.dim(), trans_02.dim()))
trans_10: torch.Tensor = inverse_transformation(trans_01)
- trans_12: torch.Tensor = compose_transformations(trans_10, trans_02)
+ trans_12: torch.Tensor = boxplus_transformation(trans_10, trans_02)
return trans_12