From 4d4641d5fa856b4c4e0b5ceaf5c30f021245116f Mon Sep 17 00:00:00 2001 From: Robin Date: Sat, 20 Jul 2024 19:17:38 +0200 Subject: [PATCH 1/2] fix projection of point cloud with no positions attribute to image --- cpp/open3d/t/geometry/PointCloud.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cpp/open3d/t/geometry/PointCloud.cpp b/cpp/open3d/t/geometry/PointCloud.cpp index f4c5b47f068..b345e0ea985 100644 --- a/cpp/open3d/t/geometry/PointCloud.cpp +++ b/cpp/open3d/t/geometry/PointCloud.cpp @@ -983,6 +983,12 @@ geometry::Image PointCloud::ProjectToDepthImage(int width, const core::Tensor &extrinsics, float depth_scale, float depth_max) { + if (!HasPointPositions()) { + utility::LogWarning( + "Called ProjectToDepthImage on a point cloud with no Positions " + "attribute. Returning empty image."); + return geometry::Image(); + } core::AssertTensorShape(intrinsics, {3, 3}); core::AssertTensorShape(extrinsics, {4, 4}); @@ -1001,6 +1007,12 @@ geometry::RGBDImage PointCloud::ProjectToRGBDImage( const core::Tensor &extrinsics, float depth_scale, float depth_max) { + if (!HasPointPositions()) { + utility::LogWarning( + "Called ProjectToRGBDImage on a point cloud with no Positions " + "attribute. Returning empty image."); + return geometry::RGBDImage(); + } if (!HasPointColors()) { utility::LogError( "Unable to project to RGBD without the Color attribute in the " From fedccb35dfd8d9114c27e54e0bbf1be5e69683fa Mon Sep 17 00:00:00 2001 From: Robin Date: Sat, 20 Jul 2024 19:43:37 +0200 Subject: [PATCH 2/2] update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e192ce692e5..91a1bebc6fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ - Fix segmentation fault (infinite recursion) of DetectPlanarPatches if multiple points have same coordinates (PR #6794) - Fix build with fmt v10.2.0 (#6783) - Fix segmentation fault (lambda reference capture) of VisualizerWithCustomAnimation::Play (PR #6804) +- Fix projection of point cloud to Depth/RGBD image if no position attribute is provided (PR #6880) ## 0.13