isl-org / Open3D

Open3D: A Modern Library for 3D Data Processing
http://www.open3d.org
Other
11.28k stars 2.28k forks source link

How to appropriately use the tensor-based fill_holes function? #6026

Open Chonghyang opened 1 year ago

Chonghyang commented 1 year ago

Checklist

My Question

I have an issue regarding the open3d.t.geometry.TriangleMesh.fill_holes method. I create a mesh from a pointcloud using BPA meshing. The mesh is then converted to a tensor based mesh using the from_legacy method. I can then use the fill_holes method and convert the mesh back to legacy format. My problem is that the code seems to be set up correctly and working, however, the fill_holes method does not do anything. Not a single faces is created. What can I do about this?

Below are pasted method of my own point cloud (and mesh) class and the output of print statements showing the properties of the pointcloud and mesh after each step.

Code:

def fill_holes(self):
    print("Filling gaps")
    start_time = time.time()
    self.t_mesh.fill_holes()
    self.mesh = self.t_mesh.to_legacy()
    end_time = time.time()
    print(f"Time taken to fill gaps: {end_time - start_time} seconds", "\n")

Print output: Saving Point Cloud Time taken to save Point Cloud: 24.954465866088867 seconds

Pcd test #1 PointCloud with 448604 points.

Generating mesh Time taken to generate faces: 29.580508947372437 seconds

Mesh test #2 TriangleMesh with 448604 points and 578407 triangles.

Calculating vertex normals Time taken to compute normals: 0.05205130577087402 seconds

Mesh test #3 TriangleMesh with 448604 points and 578407 triangles.

Saving Mesh Time taken to save Mesh: 33.49604797363281 seconds

Creating t.mesh class from legacy o3d mesh Time taken to fill gaps: 0.0444490909576416 seconds

Filling gaps [Open3D WARNING] Ignoring attribute 'normals' for TensorMap with primary key 'indices' Time taken to fill gaps: 9.302194118499756 seconds

T_Mesh test #1 TriangleMesh on CPU:0 [448604 vertices (Float32) and 578407 triangles (Int64)]. Vertex Attributes: normals (dtype = Float32, shape = {448604, 3}), colors (dtype = Float32, shape = {448604, 3}). Triangle Attributes: normals (dtype = Float32, shape = {578407, 3}).

YuMeiWangddup commented 1 year ago

hello@Chonghyang ,Imeet the same problem like you .have you found the answer?

demlow commented 1 year ago

The fill_holes documentation says it returns a new mesh with the holes filled. You're not assigning the result to anything.