예제 #1
0
    def test_from_to_projections(self, device, dtype):
        P1 = torch.tensor(
            [[[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [1.0, 0.0, 1.0, 0.0]]], device=device, dtype=dtype
        )

        P2 = torch.tensor(
            [[[1.0, 1.0, 1.0, 3.0], [0.0, 2.0, 0.0, 3.0], [0.0, 1.0, 1.0, 0.0]]], device=device, dtype=dtype
        )

        F_mat = epi.fundamental_from_projections(P1, P2)
        P_mat = epi.projections_from_fundamental(F_mat)
        F_hat = epi.fundamental_from_projections(P_mat[..., 0], P_mat[..., 1])

        F_mat_norm = epi.normalize_transformation(F_mat)
        F_hat_norm = epi.normalize_transformation(F_hat)
        assert_close(F_mat_norm, F_hat_norm, atol=1e-4, rtol=1e-4)
예제 #2
0
 def test_shape(self, batch_size, device, dtype):
     B: int = batch_size
     F_mat = torch.rand(B, 3, 3, device=device, dtype=dtype)
     P = epi.projections_from_fundamental(F_mat)
     assert P.shape == (B, 3, 4, 2)
예제 #3
0
 def test_smoke(self, device, dtype):
     F_mat = torch.rand(1, 3, 3, device=device, dtype=dtype)
     P = epi.projections_from_fundamental(F_mat)
     assert P.shape == (1, 3, 4, 2)