diff --git a/aloscene/depth.py b/aloscene/depth.py index ab52592d..fad5d26a 100644 --- a/aloscene/depth.py +++ b/aloscene/depth.py @@ -46,7 +46,6 @@ def __new__( names=("C", "H", "W"), **kwargs ): - if isinstance(x, str): x = load_depth(x) names = ("C", "H", "W") @@ -152,10 +151,10 @@ def encode_absolute( depth = torch.clamp(depth, min=prior_clamp_min, max=prior_clamp_max) if keep_negative and self.is_planar: - depth[torch.unsqueeze((depth < 1e-8) & (depth >= 0), dim=0)] = 1e-8 - depth[torch.unsqueeze((depth >= -1e-8) & (depth < 0), dim=0)] = -1e-8 + depth[(depth < 1e-8) & (depth >= 0)] = 1e-8 + depth[(depth >= -1e-8) & (depth < 0)] = -1e-8 else: - depth[torch.unsqueeze(depth < 1e-8, dim=0)] = 1e-8 + depth[depth < 1e-8] = 1e-8 depth.scale = scale depth.shift = shift @@ -234,7 +233,11 @@ def as_points3d( intrinsic = camera_intrinsic if camera_intrinsic is not None else self.cam_intrinsic projection = projection if projection is not None else self.projection distortion = distortion if distortion is not None else self.distortion - assert projection in ["pinhole", "equidistant", "kumler_bauer"], "Only pinhole, equidistant and kumler_bauer are supported." + assert projection in [ + "pinhole", + "equidistant", + "kumler_bauer", + ], "Only pinhole, equidistant and kumler_bauer are supported." # if self is not planar depth, we must convert to planar depth before projecting to 3d points if self.is_planar: