Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normal orientation issues in complex geometries #6198

Merged
merged 10 commits into from
Sep 26, 2023

Conversation

eugeniovaretti
Copy link
Contributor

@eugeniovaretti eugeniovaretti commented Jun 6, 2023

Type

  • Bug fix (non-breaking change which fixes an issue): Fixes #
  • New feature (non-breaking change which adds functionality). Resolves #
  • Breaking change (fix or feature that would cause existing functionality to not work as expected) Resolves #

Motivation and Context

While exploring existing algorithms for creating meshes from point clouds, we came across Open3D. We noticed that one of the test point clouds we had available failed to reconstruct the mesh using the normal estimation method. We investigated and studied the library regarding the methods we used, and consequently identified some weaknesses in the algorithm.

Our work is documented in this report.

Given an input point cloud, the algorithm processes the data primarily based on Euclidean distance, using the K-nearest neighbors (KNN) algorithm as a basis. In the case of specific geometries, this can be problematic when orienting two distinct surfaces of the same volume that should have opposite orientations (e.g., cusps, stenosis, etc.).

Therefore, we provide the user with the ability to manipulate two parameters in the OrientNormalsConsistentTangentPlane function (or orient_normals_consisten_tangent_plane in Python), namely lambda and cos_alpha_tol, which respectively allow for a penalty and a threshold on the distance of a point x from the plane defined by a point z and its estimated normal $n_z$ (calculated in the EstimateNormal method).

All the work is documented in the report.

Checklist:

  • I have run python util/check_style.py --apply to apply Open3D code style
    to my code.
  • This PR changes Open3D behavior or adds new functionality.
    • Both C++ (Doxygen) and Python (Sphinx / Google style) documentation is
      updated accordingly.
    • I have added or updated C++ and / or Python unit tests OR included test
      results
      (e.g. screenshots or numbers) here.
  • I will follow up and update the code if CI fails.
  • For fork PRs, I have selected Allow edits from maintainers.

Description

Below we show some of the results and improvements that follow from this modification. By using the default values for the (new) parameters, no macroscopic changes will be applied to the original algorithm.
Only a minor modification has been made to the code, specifically the initial point of traversal_queue.
All the details and motivations are provided in the report.

Original Algorithm:

image

Our changes:

image

Differences:

image

Unit Tests

All unit tests related to our modifications (PointCloud*) have passed successfully.

image

Authors

This pull request is the culmination of exceptional teamwork within an outstanding team, including @SimonePiazza99 and @federicavalentini99.


This change is Reviewable

@update-docs
Copy link

update-docs bot commented Jun 6, 2023

Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes.

@eugeniovaretti eugeniovaretti marked this pull request as ready for review June 6, 2023 18:18
@yuecideng
Copy link
Collaborator

Hi @eugeniovaretti , thanks for your work, which looks useful to achieve better normals orientation. Could you provide the full code to reproduce the results you have shown in the plots?

Our work is the result of a project for the Politecnico di Milano, and it is documented in [this report](will be available by June 19, 2023).

Looking forward to see your report.

@benjaminum
Copy link
Contributor

@eugeniovaretti Can you share your report?

@eugeniovaretti
Copy link
Contributor Author

Good morning, everyone,
sorry for the delay in replying, this period has been a bit full.
We are waiting for the go-ahead from the professor to make the report and the repository public.

@reyanshsolis
Copy link
Collaborator

Interesting work! Waiting on the report. Thanks for your valuable contribution.

@eugeniovaretti
Copy link
Contributor Author

Good morning everyone. We finally got the green light to publish our project. Find the report and the link to the reproducibility folder here: https://eugeniovaretti.github.io/meshreco/

@benjaminum
Copy link
Contributor

Good morning everyone. We finally got the green light to publish our project. Find the report and the link to the reproducibility folder here: https://eugeniovaretti.github.io/meshreco/

Thank you @eugeniovaretti ! Will check out the report

@benjaminum
Copy link
Contributor

@eugeniovaretti what will happen if we set the angle threshold to zero? Zero is obviously not a good choice, I am just interested in the effect. Will it crash or behave randomly?

@eugeniovaretti
Copy link
Contributor Author

@benjaminum As you can see in the attached pic it will behave "randomly", as each edge of the graph will be weighted equally (infinity) and the reconstruction will depend on the implementation of Kruskal's algorithm (which will select one of the multiple connected graphs with minimum weight).
image

@benjaminum
Copy link
Contributor

@eugeniovaretti That's good. Wanted to be sure that there is no crash in this specific case. The only thing missing is adding documentation for the python part. Do you think you could add documentation similar to the RaycastingScene and add an example of how to use the new parameters?

py::class_<RaycastingScene> raycasting_scene(m, "RaycastingScene", R"doc(

@eugeniovaretti
Copy link
Contributor Author

@benjaminum We have just added the Python documentation. Hope everything is ok.

Copy link
Contributor

@benjaminum benjaminum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: 0 of 6 files reviewed, all discussions resolved (waiting on @yuecideng)

@ssheorey ssheorey merged commit b2f5cef into isl-org:master Sep 26, 2023
35 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants