Skip to content

Commit

Permalink
Merge pull request #177 from Visual-Behavior/fix-depth-aspoint3d
Browse files Browse the repository at this point in the history
Check if depth is planar before projecting to 3d points
  • Loading branch information
thibo73800 authored May 16, 2022
2 parents a350972 + 95119ad commit 997e772
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion aloscene/depth.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,12 @@ def as_points3d(self, camera_intrinsic: aloscene.CameraIntrinsic = None, project
torch.arange(self.H, device=self.device), torch.arange(self.W, device=self.device)
)

z_points = self.as_tensor().view((-1, self.H * self.W))
# if self is not planar depth, we must convert to planar depth before projecting to 3d points
if self.is_planar:
z_points = self.as_tensor().view((-1, self.H * self.W))
else:
planar = self.as_planar(cam_intrinsic=intrinsic, projection=projection, distortion=distortion)
z_points = planar.as_tensor().view((-1, self.H * self.W))

if intrinsic is None:
err_msg = "The `camera_intrinsic` must be given either from the current depth tensor or from "
Expand Down

0 comments on commit 997e772

Please sign in to comment.