我需要将点云分成特定的单元大小,以便在该单元中找到Z min和Z max。我将点云转换为数组,并创建了网格,但我不知道如何拆分点云/数组来扩展网格定义。有什么建议?还是有更合适的方法?
import laspy
import numpy as np
inf = laspy.file.File('SAVA_000012.las', mode='r')
points = inf.points
points_xyz = np.array((points['point']['X'],
points['point']['Y'],
points['point']['Z'])).transpose()
x = np.arange(min(inf.X), max(inf.X), 200)
y = np.arange(min(inf.Y), max(inf.Y), 200)
print(x)
xx, yy = np.meshgrid(x, y, sparse=True, indexing= 'xy')提前感谢
发布于 2019-01-14 04:45:24
使用https://github.com/daavoo/pyntcloud:
from pyntcloud import PyntCloud
cloud = PyntCloud.from_file("SAVA_000012.las")
# Using 0.15 just for example. Omit `z` for 2D grid
voxelgrid_id = cloud.add_structure("voxelgrid", size_x=0.15, size_y=0.15)
voxelgrid = cloud.structures[voxelgrid_id]
z_max = voxelgrid.get_feature_vector(mode="z_max")您可以在此处了解有关VoxelGrid的更多信息:
https://github.com/daavoo/pyntcloud/blob/master/examples/%5Bstructures%5D%20VoxelGrid.ipynb
目前不支持z_min,但它应该很容易实现(贡献是Wellcom^^),作为参考:
https://github.com/daavoo/pyntcloud/blob/master/pyntcloud/utils/numba.py#L19
它在以下方面使用:
https://github.com/daavoo/pyntcloud/blob/master/pyntcloud/structures/voxelgrid.py#L161
https://stackoverflow.com/questions/53908090
复制相似问题