Skip to content

Commit 799c1cd

Browse files
Ido Zachevskyfacebook-github-bot
Ido Zachevsky
authored andcommitted
Allow get_rgbd_point_cloud to take any #channels
Summary: Fixed `get_rgbd_point_cloud` to take any number of image input channels. Reviewed By: bottler Differential Revision: D52796276 fbshipit-source-id: 3ddc0d1e337a6cc53fc86c40a6ddb136f036f9bc
1 parent 292acc7 commit 799c1cd

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

pytorch3d/implicitron/tools/point_cloud_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ def get_rgbd_point_cloud(
8080
mode="bilinear",
8181
align_corners=False,
8282
)
83-
pts_colors = pts_colors.permute(0, 2, 3, 1).reshape(-1, 3)[pts_mask]
83+
pts_colors = pts_colors.permute(0, 2, 3, 1).reshape(-1, image_rgb.shape[1])[
84+
pts_mask
85+
]
8486

8587
return Pointclouds(points=pts_3d[None], features=pts_colors[None])
8688

tests/implicitron/test_pointcloud_utils.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,11 @@ def test_unproject(self):
6262
)
6363
[points] = cloud.points_list()
6464
self.assertConstant(torch.norm(points, dim=1), depth, atol=1e-5)
65+
66+
# 3. four channels
67+
get_rgbd_point_cloud(
68+
camera,
69+
image_rgb=image[None],
70+
depth_map=image[3:][None],
71+
euclidean=True,
72+
)

0 commit comments

Comments
 (0)