Skip to content

Commit cf4c553

Browse files
authored
Merge pull request #141 from Visual-Behavior/fix-depth-occ
fix append occlusion and title view
2 parents 35e3e4a + dac0626 commit cf4c553

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

aloscene/depth.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@ def append_occlusion(self, occlusion: Mask, name: str = None):
4545
If none, the occlusion mask will be attached without name (if possible). Otherwise if no other unnamed
4646
occlusion mask are attached to the frame, the mask will be added to the set of mask.
4747
"""
48-
self._append_label("occlusion", occlusion, name)
48+
self._append_child("occlusion", occlusion, name)
4949

50-
def __get_view__(self, cmap="nipy_spectral", min_depth=0, max_depth=200):
50+
def __get_view__(self, cmap="nipy_spectral", min_depth=0, max_depth=200, title=None):
5151
assert all(dim not in self.names for dim in ["B", "T"]), "Depth should not have batch or time dimension"
5252
cmap = matplotlib.cm.get_cmap(cmap)
5353
depth = self.rename(None).permute([1, 2, 0]).detach().cpu().contiguous().numpy()
5454

5555
depth = max_depth - np.clip(depth, min_depth, max_depth)
5656
depth = matplotlib.colors.Normalize(vmax=max_depth)(depth)
5757
depth_color = cmap(depth)[:, :, 0, :3]
58-
return View(depth_color)
58+
return View(depth_color, title=title)
5959

6060
def as_points3d(self, camera_intrinsic: aloscene.CameraIntrinsic = None):
6161
"""Compute the 3D coordinates of points 2D points based on their respective depth.

0 commit comments

Comments
 (0)