激光雷达点云的裁剪 python open3d实现

描述:在三维点云空间中,我们需要裁剪掉不关注的区域

 

使用open3d库

原始点云输入为:

原始点云
import os
import numpy as np
import open3d as o3d



#load pcd file
pcd_file = '1.pcd'
pcd = o3d.io.read_point_cloud(pcd_file)

print(pcd)

#The region we wanted using x-axis and y-axis
#Like a bird's eye view
bounding_ploy = np.array([
                          [1.3, 6.1, 0],
                          [0.864, -6.518, 0],
                          [15, -41, 0],
                          [42.774, -41.181, 0],
                          [62.1, -33.3, 0],
                          [77.8, -8.2, 0],
                          [23.8, 32.2, 0],
                          [8, 25, 0]
                         ], dtype = np.float32).reshape([-1, 3]).astype("float64")

print(bounding_ploy)

bounding_polygon = np.array(bounding_ploy, dtype = np.float64)

vol = o3d.visualization.SelectionPolygonVolume()

#The Z-axis is used to define the height of the selected region
vol.orthogonal_axis = "Z"
vol.axis_max = 8
vol.axis_min =-16


vol.bounding_polygon = o3d.utility.Vector3dVector(bounding_polygon)
comp = vol.crop_point_cloud(pcd)
print(comp)
xyz_load = np.asarray(comp.points)

#save the cropped region
np.savetxt( '1_' + '.txt', xyz_load)

裁剪后的点云:

裁剪后的点云

 

  • 4
    点赞
  • 28
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值