-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmeshlab_script.py
More file actions
52 lines (37 loc) · 1.68 KB
/
meshlab_script.py
File metadata and controls
52 lines (37 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import sys
import pymeshlab
def screened_poisson_surface_reconstruction():
mesh_path = sys.argv[1]
# Create a MeshSet object
ms = pymeshlab.MeshSet()
# Import the point cloud file in ".ply" format
ms.load_new_mesh(mesh_path)
# Compute normals for point sets
ms.compute_normal_for_point_clouds()
# Perform Screened Poisson Surface Reconstruction
ms.generate_surface_reconstruction_screened_poisson(depth=8, scale=1, samplespernode=2)
# Select faces with edges longer than a default threshold
ms.compute_selection_by_edge_length()
# Remove selected faces
ms.meshing_remove_selected_faces()
# Remove isolated pieces with the option to remove unreferenced vertices
ms.meshing_remove_connected_component_by_face_number()
ms.apply_coord_laplacian_smoothing_surface_preserving(angledeg=90, iterations=30)
# # Perform Per Vertex Texture Function
# ms.compute_texcoord_by_function_per_vertex()
#
# # Convert PerVertex UV into PerWedge UV
# ms.compute_texcoord_transfer_vertex_to_wedge()
#
# # Parametrization: trivial per-triangle with specified parameters
# ms.compute_texcoord_parametrization_triangle_trivial_per_wedge(textdim=4096, border=0, method=0)
# Export the mesh as a .ply file
ms.save_current_mesh(mesh_path,
save_vertex_quality=False,
save_face_quality=False,
save_face_color=False,
save_wedge_color=False,
save_wedge_normal=False)
print("Mesh processing completed and saved as 'output_mesh.ply'")
if __name__ == '__main__':
screened_poisson_surface_reconstruction()