使用CSF算法做点云地面滤波处理,分离地面与非地面

本文介绍了如何使用CSF库对LAS点云数据进行布料模拟滤波,通过设置参数并执行滤波操作,将点云分为地面点和非地面点,分别保存为两个新的LAS文件。
import laspy
import CSF
import numpy as np

inFile = laspy.file.File(r'/home/jiang/桌面/J/jiang/B/132695079545146682-point-cloud - Cloud.las', mode='r') # read a las file
points = inFile.points
xyz = np.vstack((inFile.x, inFile.y, inFile.z)).transpose() # extract x, y, z and put into a list

# ============布料模拟滤波============
csf = CSF.CSF()
# 参数设置
csf.params.bSloopSmooth = True
csf.params.cloth_resolution = 1 # 布料网格分辨率
csf.params.rigidness = 3  # 布料刚性参数
csf.params.time_step = 0.65
csf.params.class_threshold = 0.1  # 点云与布料模拟点的距离阈值
csf.params.interations = 500  # 最大迭代次数
# more details about parameter: http://ramm.bnu.edu.cn/projects/CSF/download/

csf.setPointCloud(xyz)
ground = CSF.VecInt()  # 地面点索引列表
non_ground = CSF.VecInt()  # 非地面点索引列表
csf.do_filtering(ground, non_ground)  # 执行滤波
# ============保存为las文件==========
outFile = laspy.file.File(r"B-ground.las",
                          mode='w', header=inFile.header)
outFile.points = points[ground]
outFile.close()
outfile = laspy.file.File(r"B-non_ground.las",
                          mode='w', header=inFile.header)
outfile.points = points[non_ground]
outfile.close()

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值