Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions aloscene/depth.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ def append_occlusion(self, occlusion: Mask, name: str = None):
If none, the occlusion mask will be attached without name (if possible). Otherwise if no other unnamed
occlusion mask are attached to the frame, the mask will be added to the set of mask.
"""
self._append_label("occlusion", occlusion, name)
self._append_child("occlusion", occlusion, name)

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

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

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