PLY color scaling

Summary: When a PLY file contains colors in byte format, these are now scaled from 0..255 to [0,1], as they should be

Reviewed By: gkioxari

Differential Revision: D27765254

fbshipit-source-id: 526b5f5149d5e8cbffd7412b411be52c935fa4ad
This commit is contained in:
Jeremy Reizenstein
2021-05-04 05:35:24 -07:00
committed by Facebook GitHub Bot
parent 6c3fe952d1
commit e9f4e0d086
2 changed files with 36 additions and 10 deletions

View File

@@ -448,7 +448,7 @@ class TestMeshPlyIO(TestCaseMixin, unittest.TestCase):
torch.FloatTensor([0, 1, 2]) + 7 * torch.arange(8)[:, None],
)
self.assertClose(
pointcloud.features_padded()[0],
pointcloud.features_padded()[0] * 255,
torch.FloatTensor([3, 4, 5]) + 7 * torch.arange(8)[:, None],
)
@@ -518,7 +518,7 @@ class TestMeshPlyIO(TestCaseMixin, unittest.TestCase):
self.assertEqual(pointcloud_gpu.device, torch.device("cuda:0"))
pointcloud = pointcloud_gpu.to(torch.device("cpu"))
expected_points = torch.tensor([[[2, 5, 3]]], dtype=torch.float32)
expected_features = torch.tensor([[[4, 1, 6]]], dtype=torch.float32)
expected_features = torch.tensor([[[4, 1, 6]]], dtype=torch.float32) / 255.0
self.assertClose(pointcloud.points_padded(), expected_points)
self.assertClose(pointcloud.features_padded(), expected_features)