@@ -125,32 +125,33 @@ Open3D is a versatile open-source library for 3D data processing that provides t
125
125
import open3d as o3d
126
126
import sys
127
127
128
- """
129
- This script reconstructs surfaces from a point cloud using Poisson Surface reconstruction
130
- using Open3D's API (version 0.18.0)
131
-
132
- Input: point cloud -> Output: mesh
133
- """
128
+ # parameters for normal estimation for each point in PCD
129
+ ne_max_radius = 0.1 # choose this dependent on the scale and density of your PCD
130
+ ne_max_nn = 30 # choose this dependent on density of your PCD
131
+
132
+ # parameters for poission reconstruction
133
+ possion_depth = 11 # the higher the more details, the more RAM is used
134
+ density_filter = 0.05 # filter surface patches with low 'evidence'
135
+
136
+ # This script reconstructs surfaces from a point cloud using Poisson Surface reconstruction
137
+ # using Open3D's API (version 0.18.0)
138
+ #
139
+ # Input: point cloud -> Output: mesh
134
140
if __name__ == ' __main__' :
135
141
file_in = sys.argv[1 ]
136
142
file_out = sys.argv[2 ]
137
-
138
143
pcd = o3d.io.read_point_cloud(file_in)
139
144
140
145
print (" Estimating point normals..." )
141
- pcd.estimate_normals(search_param = o3d.geometry.KDTreeSearchParamHybrid(radius = 0.1 , max_nn = 30 ))
142
-
143
- # Tweek the following parameters
144
- depth = 11 # the higher the more details, the more RAM is used
145
- density_filter = 0.05
146
+ pcd.estimate_normals(search_param = o3d.geometry.KDTreeSearchParamHybrid(radius = ne_max_radius, max_nn = ne_max_nn))
146
147
147
148
print (" Starting Poisson surface reconstruction..." )
148
149
mesh, densities = o3d.geometry.TriangleMesh.create_from_point_cloud_poisson(pcd, depth = depth)
149
150
150
151
print (" Removing vertices with low Poission density" )
151
152
vertices_to_remove = densities < np.quantile(densities, density_filter)
152
153
mesh.remove_vertices_by_index(np.where(vertices_to_remove)[0 ])
153
-
154
+
154
155
# Save the mesh
155
156
o3d.io.write_triangle_mesh(file_out, mesh)
156
157
```
0 commit comments