23 lines
596 B
Python
23 lines
596 B
Python
|
import open3d as o3d
|
||
|
import numpy as np
|
||
|
|
||
|
# 读取第一个PLY文件
|
||
|
pcd1 = o3d.io.read_point_cloud("path_to_first_file.ply")
|
||
|
|
||
|
# 读取第二个PLY文件
|
||
|
pcd2 = o3d.io.read_point_cloud("path_to_second_file.ply")
|
||
|
|
||
|
# 可选:如果需要调整坐标系,可以通过平移、旋转来对齐点云
|
||
|
# 例如,平移第二个点云
|
||
|
offset = np.array([1000, 2000, 3000])
|
||
|
pcd2.translate(offset)
|
||
|
|
||
|
# 合并点云
|
||
|
combined_pcd = pcd1 + pcd2
|
||
|
|
||
|
# 保存合并后的点云为PLY文件
|
||
|
o3d.io.write_point_cloud("merged_output.ply", combined_pcd)
|
||
|
|
||
|
# 可视化
|
||
|
o3d.visualization.draw_geometries([combined_pcd])
|