fix alpha shape reconstruction if alpha too small for point scale #6998
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type
Motivation and Context
Surface reconstruction with alpha shapes by calling
create_from_point_cloud_alpha_shape
fails if the alpha value is too small for the internal constraint to become true.Open3D/cpp/open3d/geometry/SurfaceReconstructionAlphaShape.cpp
Lines 105 to 110 in db00e33
There is currently no check if the reconstructed mesh is empty, thus the following call to
Open3D/cpp/open3d/geometry/SurfaceReconstructionAlphaShape.cpp
Lines 165 to 168 in db00e33
leads to a non-descriptive unordered_map key error.
To reproduce, an easy test is to attempt surface reconstruction with the Bunny and the Armadillo Mesh.
While the bunny mesh works fine with the tutorial alpha shape values (e.g. 0.03), the Armadillo mesh fails.
This is a point scale issue, i.e.
max_bound
(Armadillo) is [62.1 96.4 56.8] andmax_bound
(Bunny) is [0.061 0.187 0.058]. If the alpha is large enough (e.g. 10), or the points are scaled down, it works again for the Armadillo.To reproduce the error:
Checklist:
python util/check_style.py --apply
to apply Open3D code styleto my code.
updated accordingly.
results (e.g. screenshots or numbers) here.
Description
To prevent the error, I've added a check if the mesh is empty after the alpha shape reconstruction is completed. If it is empty, a warning is logged and the empty mesh gets returned.