raise ValueError("Input matrix must be a Bx2x3 tensor. Got {}"
.format(A.shape))
H: torch.Tensor = torch.nn.functional.pad(A, [0, 0, 0, 1], "constant", value=0.)
H[..., -1, -1] += 1.0return H
def convert_affinematrix_to_homography3d(A: torch.Tensor) -> torch.Tensor:
rFunction that converts batch of affine matrices from [Bx3x4] to [Bx4x4].
After Change
if not (len(A.shape) == 3 and A.shape[-2:] == (2, 3)):
raise ValueError("Input matrix must be a Bx2x3 tensor. Got {}"
.format(A.shape))
return _convert_affinematrix_to_homography_impl(A)
def convert_affinematrix_to_homography3d(A: torch.Tensor) -> torch.Tensor:
rFunction that converts batch of affine matrices from [Bx3x4] to [Bx4x4].