import open3d as o3d from scipy.ndimage import binary_fill_holes def merge_ply(ply1, ply2, output_path): # 加载两个多边形模型 mesh1 = o3d.io.read_triangle_mesh(ply1) mesh2 = o3d.io.read_triangle_mesh(ply2) # 使用 + 运算符合并两个多边形模型 merged_mesh = mesh1 + mesh2 # 去除合并后的重复顶点和三角形 merged_mesh.remove_duplicated_vertices() merged_mesh.remove_duplicated_triangles() # 可选:合并近距离的顶点 # merged_mesh.merge_close_vertices(distance=0.001) # 保存或可视化合并后的多边形模型 o3d.io.write_triangle_mesh("path_to_output_mesh.ply", merged_mesh) o3d.visualization.draw_geometries([merged_mesh]) if __name__ == '__main__': ply1 = "Left-Caudate.ply" ply2 = "Left-Lenticula.ply" merge_ply_path = "merged_mesh.ply" merge_ply(ply1, ply2, merge_ply_path)
合并后的ply文件:
标签:__,模型,ply,merge,open3d,o3d,merged,mesh From: https://www.cnblogs.com/hxqmw/p/18386042