1

I create a mesh by using 'open3d.geometry.TriangleMesh.create_from_point_cloud_alpha_shape' function and wanted to calculate the volume of it. But a RuntimeError occurs as the following shows:

[Open3D WARNING] [CreateFromPointCloudAlphaShape] invalid tetra in TetraMesh
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Input In [27], in <cell line: 7>()
      3 point_cloud.points = open3d.utility.Vector3dVector(data_all)
      5 tri_mesh = open3d.geometry.TriangleMesh.create_from_point_cloud_alpha_shape(point_cloud, alpha=10)
----> 7 v = open3d.geometry.TriangleMesh.get_volume(tri_mesh)
      8 print(v)

RuntimeError: [Open3D Error] (double open3d::geometry::TriangleMesh::GetVolume() const) /Users/runner/work/Open3D/Open3D/cpp/open3d/geometry/TriangleMesh.cpp:1220: The mesh is not watertight, and the volume cannot be computed.

I searched online (https://github.com/isl-org/Open3D/pull/3201) and found that the warning message (invalid tetra in TetraMesh) is a common problem and the reason is that some points are inside the mesh and not in the surface. Therefore, I exclude all the points that are not in the surface by calculating each point's distance to the surface.

Then, I recreate the mesh by using 'open3d.geometry.TriangleMesh.create_from_point_cloud_alpha_shape' function. The same issue occurs and the mesh is still not watertight.

Is there any method to solve this problem and calculate the volume?

Thanks!

1 Answers1

1

In order to compute the volume you need a watertight mesh, which means it must have no openings. This isn't something the alpha shape algorithm guarantees; f you pick a smaller alpha, eventually it will just create tiny islands or isolated triangles. The tutorial has examples of what happens with different alphas: http://www.open3d.org/html/tutorial/Advanced/surface_reconstruction.html

You can check whether you had success with tri_mesh.is_watertight().

But the core problem here is really how to make the mesh watertight, which is asked and answered in this question.

Maybe picking a larger alpha is good enough for your case, or maybe you would be better served by an alternative algorithm like create_from_point_cloud_poisson (which should be guaranteed watertight, volume would be underestimated if the shape is mostly convex) or create_from_point_cloud_ball_pivoting.

You should plot your geometries and point cloud for visual inspection, and also compare the volume from each method.

Mikael Öhman
  • 2,294
  • 15
  • 21
  • Thank you so much for you response. I tried the create_from_point_cloud_poisson function, but the mesh is still not watertight. My solution now is to slice it into 2d images, and then calculate the volume. – Xiaoqing Li Jul 25 '23 at 06:34
  • It's hard to know what went wrong then without seeing a plot of the point cloud and the generated meshes. – Mikael Öhman Jul 25 '23 at 08:20
  • Hi I edited the question and add the picture of the mesh. Appreciate your help. – Xiaoqing Li Jul 26 '23 at 02:14