解决问题:
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))points = inFile.pointsxyz = np.vstack((inFile.x, inFile.y, inFile.z)).transpose() csf = CSF.CSF()csf.params.bSloopSmooth = True csf.params.cloth_resolution = 0.5 csf.params.rigidness = 1 csf.params.time_step = 0.65 csf.params.class_threshold = 0.5 csf.params.interations = 500 csf.setPointCloud(xyz)ground = CSF.VecInt() non_ground = CSF.VecInt() csf.do_filtering(ground, non_ground) 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] outFile.close()outFile2 = laspy.file.File(r"%s_non_ground.las"% file_name2, mode='w', header=inFile.header) outFile2.points = points[non_ground] outFile2.close()