import open3d as o3d
import numpy as np
import copy
pcd = o3d.io.read_point_cloud("xuanran//edit//pc.ply")
center = -1*pcd.get_center() #get_center()求点云重心
pcd_tx = copy.deepcopy(pcd).translate(center)#平移到重心位置
obb = pcd_tx.get_oriented_bounding_box()
bound = obb.get_max_bound()
print(bound)
len = max(bound[0],bound[1],bound[2])
sca = 5/len #此处更改点云尺度
print(sca)
pcd_s = pcd_tx.scale(sca, center=pcd_tx.get_center())
print(f'Center of mesh: {center}')
print(f'Center of mesh tx: {pcd_tx.get_center()}')
o3d.io.write_point_cloud('xuanran//edit//pc2.ply',pcd_s)
对点云更改重心位置和尺度python代码
最新推荐文章于 2023-11-30 12:02:39 发布