热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

python解决CSF布料模拟滤波的批处理问题(解决获取多个点云数据las数据)

解决问题:1、批量读取点云las数据2、点云数据读与写出3、csf滤波分类参考:https:github.comsuyunzzzCSF论文题目ÿ

解决问题:
1、批量读取点云las数据
2、点云数据读与写出
3、csf滤波分类
参考:https://github.com/suyunzzz/CSF
论文题目:An Easy-to-Use Airborne LiDAR Data Filtering Method Based on Cloth Simulation(Wuming Zhang,2016)


import laspy
import CSF
import numpy as np
import os
import pandas as pd
path ="D://***//python测试//"
path2 = os.listdir(path)for f in path2:inFile = laspy.file.File(os.path.join(path, f))#inFile = laspy.file.File(r"D:\***\python测试\9.las", mode='r') # read a las filepoints = inFile.pointsxyz = np.vstack((inFile.x, inFile.y, inFile.z)).transpose() # extract x, y, z and put into a listcsf = CSF.CSF()# prameter settingscsf.params.bSloopSmooth = True ##滤波后处理(针对陡坡)csf.params.cloth_resolution = 0.5 ##格网大小csf.params.rigidness = 1 # 布料硬度csf.params.time_step = 0.65 # 时间步长DTcsf.params.class_threshold = 0.5 # 分类阈值csf.params.interations = 500 # 迭代次数# 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 calculationnon_ground = CSF.VecInt() # a list to indicate the index of non-ground points after calculationcsf.do_filtering(ground, non_ground) # do actual filtering.file_name = os.path.basename(f)file_name2 = file_name.split('.')[0]outFile = laspy.file.File(r"%s_ground.las"% file_name2, mode='w', header=inFile.header) ##地面点outFile.points = points[ground] # extract ground points, and save it to a las file.outFile.close()outFile2 = laspy.file.File(r"%s_non_ground.las"% file_name2, mode='w', header=inFile.header) ###非地面点outFile2.points = points[non_ground] # extract non_ground points, and save it to a las file.outFile2.close() # do not forget this


推荐阅读
author-avatar
菲拉慕格_516
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有