- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我真的是 python 编程的新手,我只是想知道您是否可以使用 LiDAR 点创建分辨率为 0.5 x o.5 m 的规则网格。
我的数据是 LAS 格式(从 liblas 导入文件作为 lasfile 读取)并且它们具有以下格式:X,Y,Z。其中 X 和 Y 是坐标。
这些点是随机定位的,一些像素是空的(NAN 值),在一些像素中有更多的一个点。在一个点较多的地方,我希望获得一个平均值。最后,我需要将数据保存为 TIF 格式或 Ascii 格式。
我正在研究 osgeo 模块和 GDAL,但老实说,我不知道 osgeo 模块是否是最佳解决方案。
我很高兴能得到一些我可以学习和实现的代码的帮助,
提前感谢您的帮助,我真的需要。
我不知道使用这些参数获取网格的最佳方法。
最佳答案
有点晚了,但也许这个答案对其他人有用,如果不是对你...
我已经用 Numpy 和 Pandas 完成了这个,而且速度非常快。我使用的是 TLS 数据,并且可以在一台像样的 2009 年老式笔记本电脑上毫无问题地使用数百万个数据点来完成此操作。关键是通过舍入数据来“分箱”,然后使用 Pandas 的 GroupBy 方法进行聚合并计算均值。
如果你需要舍入到 10 的幂,你可以使用 np.round,否则你可以通过创建一个函数来舍入到任意值,我通过修改 this SO answer 来完成。 .
import numpy as np
import pandas as pd
# make rounding function:
def round_to_val(a, round_val):
return np.round( np.array(a, dtype=float) / round_val) * round_val
# load data
data = np.load( 'shape of ndata, 3')
n_d = data.shape[0]
# round the data
d_round = np.empty( [n_d, 5] )
d_round[:,0] = data[:,0]
d_round[:,1] = data[:,1]
d_round[:,2] = data[:,2]
del data # free up some RAM
d_round[:,3] = round_to_val( d_round[:,0], 0.5)
d_round[:,4] = round_to_val( d_round[:,1], 0.5)
# sorting data
ind = np.lexsort( (d_round[:,4], d_round[:,3]) )
d_sort = d_round[ind]
# making dataframes and grouping stuff
df_cols = ['x', 'y', 'z', 'x_round', 'y_round']
df = pd.DataFrame( d_sort)
df.columns = df_cols
df_round = df[['x_round', 'y_round', 'z']]
group_xy = df_round.groupby(['x_round', 'y_round'])
# calculating the mean, write to csv, which saves the file with:
# [x_round, y_round, z_mean] columns. You can exit Python and then start up
# later to clear memory if that's an issue.
group_mean = group_xy.mean()
group_mean.to_csv('your_binned_data.csv')
# Restarting...
import numpy as np
from scipy.interpolate import griddata
binned_data = np.loadtxt('your_binned_data.csv', skiprows=1, delimiter=',')
x_bins = binned_data[:,0]
y_bins = binned_data[:,1]
z_vals = binned_data[:,2]
pts = np.array( [x_bins, y_bins])
pts = pts.T
# make grid (with borders rounded to 0.5...)
xmax, xmin = 640000.5, 637000
ymax, ymin = 6070000.5, 6067000
grid_x, grid_y = np.mgrid[640000.5:637000:0.5, 6067000.5:6070000:0.5]
# interpolate onto grid
data_grid = griddata(pts, z_vals, (grid_x, grid_y), method='cubic')
# save to ascii
np.savetxt('data_grid.txt', data_grid)
完成此操作后,我将输出保存为 .npy 并使用图像库转换为 tiff,然后在 ArcMap 中进行地理配准。可能有一种方法可以用 osgeo 做到这一点,但我还没有用过。
希望这至少对某人有帮助...
关于python - 如何使用 GDAL python 从 LiDAR 点(X、Y、Z)创建网格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12587171/
我是 Metal 和 ARkit 的新手。我开始学习激光雷达和场景的深度数据来可视化形状。下面是苹果开发者提供的点云示例代码的链接。 https://developer.apple.com/docum
任务 我要 capture 真实世界的纹理,并将其应用到在激光雷达扫描仪的帮助下生成的 3D 网格。我想应该使用 Projection-View-Model 矩阵。纹理必须从固定的视点制作,例如,从房
在一个项目中,我们正在创建公寓的虚拟游览。我们要在该虚拟图像中显示房间尺寸。到目前为止,我们正在使用RICO theta v创建虚拟导览。下面给出一个例子。 第一张图片显示了房间的全景。现在使用激光雷
我正在研究分类问题(自动驾驶车辆的对象分类)。我使用 KITTI 的数据集,它提供 LiDAR 和相机数据,并希望使用这两个数据来执行任务。 3D LIDAR 数据被投影到 RGB 图像的坐标系上,从
在 Swift 中有没有办法检查设备是否有 LiDAR 传感器?不幸的是,我在 Apple 官方纪录片和互联网搜索中都没有找到任何内容。 我目前的解决方法是确定设备类型,如本文所述: How to d
我有 .las(激光雷达数据)文件,现在我想知道它的大小,例如它的宽度和高度(以千米为单位)。 如何检索此类信息? 最佳答案 tl;dr:安装 libLAS 并运行 lasinfo myfile.la
我想创建一个实时的点绘图 GUI。我正在使用 Scanse Sweep LiDAR,在每次扫描此 LiDAR(工作频率在 1 - 10Hz 之间)时,我都会收到大约 1000 个点 (x, y) 来描
我正在使用基于 WebGL 的 WebAR 现实(实时 SLAM 和跟踪)。 并且想知道是否有任何方法可以访问 LiDAR API 并在 Safari 浏览器中使用它? 我找不到任何有用的信息。 最佳
我在很多论坛上看到如果我们要开发一个LiDAR应用程序,我们需要使用RealityKit , 而不是 SceneKit .我正在开发Apple LiDAR Tutorial .但是我没有使用 Real
如何导出 ARMeshGeometry新生成的SceneReconstruction最新 iPad Pro 上的 API .obj文件? 这是SceneReconstruction文档。 最佳答案 从
我真的是 python 编程的新手,我只是想知道您是否可以使用 LiDAR 点创建分辨率为 0.5 x o.5 m 的规则网格。 我的数据是 LAS 格式(从 liblas 导入文件作为 lasfil
我是一名优秀的程序员,十分优秀!