import time
import open3d as o3d;
import numpy as np;
import matplotlib.pyplot as plt
from scipy.signal import find_peaks#坐标
mesh_coord_frame = o3d.geometry.TriangleMesh.create_coordinate_frame(size=355, origin=[0, 0, 0])
#mesh_coord_frame = mesh_coord_frame.translate((0.16, 0.15, 0)) #加载点云数据
tic = time.time()
OriginalPly = o3d.io.read_point_cloud("source/Glue4.ply")
toc = 1000 * (time.time() - tic)
print("加载点云耗时 {:.0f} [ms]".format(toc))o3d.visualization.draw_geometries([ OriginalPly ],window_name="OriginalPly ") # 定义立方体的边界
min_bound = np.array([-1200,10, -1])
max_bound = np.array([1200, 50, 200])
bounding_box=o3d.geometry.AxisAlignedBoundingBox(min_bound,max_bound)
# 使用边界值创建一个新的点云对象,只包含在立方体内的点
pcd_in_box = OriginalPly .crop(bounding_box)o3d.visualization.draw_geometries([ pcd_in_box],window_name="cropped_pcd")
原始点云
截取后的效果