CSF

基于布料模拟的机载LiDAR滤波方法。 这是文章的代码:

https://github.com/jianboqi/CSF

1. 什么是CSF?

CSF是cloth simulation filter算法的简称,其基本原理就是在倒置的点云上放置一块布料,然后模拟布料与点云的作用,最终布料的形状可以近似地形的走势,可以利用点与布料直接的距离对原始点云进行分类(地面点和非地面点)。
在这里插入图片描述

W. Zhang, J. Qi*, P. Wan, H. Wang, D. Xie, X. Wang, and G. Yan, “An Easy-to-Use Airborne LiDAR Data Filtering Method Based on Cloth Simulation,” Remote Sens., vol. 8, no. 6, p. 501, 2016. (http://www.mdpi.com/2072-4292/8/6/501/htm)

2. Python接口的使用。

CSF本身是用C++开发的,可以保证执行效率。只是在此基础上利用了swig对其添加了一层Python的接口。因此可以通过Python执行CSF滤波。

现在,我们用swig包装了CSF的Python接口。 现在使用起来更简单。 这项新功能可以使CSF更易于嵌入到大型项目中。 例如,它可以与Laspy(https://github.com/laspy/laspy)一起使用。 您要做的只是将点云读取到python 2D列表中,并将其传递给CSF。 以下示例显示了如何将其与laspy一起使用。

las格式:

使用las格式需要先安装laspy这个库(pip install laspy)。

# coding: utf-8
import laspy
import CSF
import numpy as np

inFile = laspy.file.File(r"in.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()

# prameter settings
csf.params.bSloopSmooth = False
csf.params.cloth_resolution = 0.5
# more details about parameter: http://ramm.bnu.edu.cn/projects/CSF/download/

csf.setPointCloud(xyz)
ground = CSF.VecInt()  # a list to indicate the index of ground points after calculation
non_ground = CSF.VecInt() # a list to indicate the index of non-ground points after calculation
csf.do_filtering(ground, non_ground) # do actual filtering.

outFile = laspy.file.File(r"ground.las",
                          mode='w', header=inFile.header)
outFile.points = points[ground] # extract ground points, and save it to a las file.
outFile.close() # do not forget this

从txt文件读取数据

如果激光雷达数据存储在txt文件中(每行x y z),则也可以直接将其导入。

import CSF

csf = CSF.CSF()
csf.readPointsFromFile('samp52.txt')

csf.params.bSloopSmooth = False
csf.params.cloth_resolution = 0.5

ground = CSF.VecInt()  # a list to indicate the index of ground points after calculation
non_ground = CSF.VecInt() # a list to indicate the index of non-ground points after calculation
csf.do_filtering(ground, non_ground) # do actual filtering.
csf.savePoints(ground,"ground.txt")

参数说明

虽然CSF有几个参数需要设置,但是大部分情况只用修改一两个即可。

  • cloth_resolutinon: 表示布料网格大小,一般与点云间距相当。默认0.5m。
  • bSlopeSmooth: 是否进行边坡后处理。当有陡变地形是设置为ture。
  • rigidness: 布料硬度。可选值1,2,3. 1表示平坦地形。2表示有缓坡的地形。3表示有较陡的地形(比如山地)。

以上就是python点云滤波库CSF的主要使用步骤。

如何在Python中使用CSF

下载源代码。 在python文件夹下:

python setup.py build
python setup.py install 

在这里插入图片描述

如何在Matlab中使用CSF

在matlab文件夹下的demo_mex.m文件中查看更多详细信息。

如何在C ++中使用CSF

现在,CSF由CMake构建,它生成了一个静态库,该库可被其他c ++程序使用。

linux

要构建库,请运行:

mkdir build #or other name
cd build
cmake ..
make
sudo make install

或者如果您想构建库和演示可执行文件csfdemo

mkdir build #or other name
cd build
cmake -DBUILD_DEMO=ON ..
make
sudo make install
  • 2
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
CSF是脑脊液(cerebrospinal fluid)的缩写,它是一种在人体中起到重要功能的液体。CSF环绕在脑和脊髓周围,并提供了保护和支持的作用。CSF还参与了物质交换以及神经元之间的信号传导。在医学研究中,研究人员使用CSF模型来研究不同物质在脑脊液中的影响和作用。通过这种模型,研究人员可以更好地了解人体对不同物质的敏感度。 如果您对CSF模型感兴趣,并且想要使用Python进行相关研究,可以参考一篇文章 "@inproceedings{Watson02,author = {Watson, Andrew and Malo, Jesús},year...。" 这篇文章可以提供关于使用Python进行CSF模型研究的相关信息和方法。根据文章的引用格式信息,可以在相关会议的论文集中找到这篇文章的详细内容。 在Python中你可以使用不同的库和工具来构建CSF模型,如numpy、scipy和pandas。你可以使用这些库来处理和分析数据,并使用绘图库如matplotlib来可视化CSF模型的结果。在代码中,你可能需要定义模型的参数和方程,并使用适当的算法来模拟和分析CSF的行为。 总结起来,如果你想使用Python进行CSF模型的研究,可以参考引用的文章 "@inproceedings{Watson02,author = {Watson, Andrew and Malo, Jesús},year...。"该文章提供了关于使用Python构建CSF模型的相关信息和方法。你可以使用numpy、scipy和pandas等库来处理数据,使用matplotlib等库来可视化结果,并使用适当的算法来模拟和分析CSF的行为。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值