Save out dataparser transforms (#1105)

* Save out dataparser transforms

* Make missing folder
This commit is contained in:
Matthew Tancik authored and GitHub committed 2022-12-11 13:02:50 -08:00
1 parent 90447ab223
commit b41ce8060a
11 files changed
+56 -175

No files matched your search

+7 -5
View File
@@ -409,7 +409,7 @@ def rotation_matrix(a: TensorType[3], b: TensorType[3]) -> TensorType[3, 3]:
def auto_orient_and_center_poses(
poses: TensorType["num_poses":..., 4, 4], method: Literal["pca", "up", "none"] = "up", center_poses: bool = True
) -> TensorType["num_poses":..., 3, 4]:
) -> Tuple[TensorType["num_poses":..., 3, 4], TensorType[4, 4]]:
"""Orients and centers the poses. We provide two methods for orientation: pca and up.
pca: Orient the poses so that the principal component of the points is aligned with the axes.
@@ -424,7 +424,7 @@ def auto_orient_and_center_poses(
center_poses: If True, the poses are centered around the origin.
Returns:
The oriented poses.
Tuple of the oriented poses and the transform matrix.
"""
translation = poses[..., :3, 3]
@@ -457,7 +457,9 @@ def auto_orient_and_center_poses(
transform = torch.cat([rotation, rotation @ -translation[..., None]], dim=-1)
oriented_poses = transform @ poses
elif method == "none":
oriented_poses = poses[:, :3]
oriented_poses[..., 3] -= translation
transform = torch.eye(4)
transform[:3, 3] = -translation
transform = transform[:3, :]
oriented_poses = transform @ poses
return oriented_poses
return oriented_poses, transform