如何利用稀疏采样数据制作地形图?
我需要制作地形图,而我只有相当稀疏的(x, y, 高度)数据样本。显然我无法制作一张完全准确的地图,但我想要一张在某种意义上“平滑”的地图。我需要量化“平滑度”(可能是表面曲率平方平均值的倒数),并且我想最小化作为两个量之和的目标函数:
- 表面的粗糙度
- 高度之间的均方距离采样点的表面和该点的实际测量高度
因为我真正想要的是地形图,所以我真的在寻找一种构建恒定高度等高线的方法,并且可能有一些巧妙的几何方法来做到这一点无需谈论表面。当然我希望轮廓线也能平滑。
欢迎任何和所有建议。我希望这是一个众所周知的数值问题。我对 C 语言非常熟悉,并且具备 FORTRAN 的应用知识。关于Matlab和R我相当一无所知。
关于我们的样本所在的位置:我们计划大致均匀的间距,但我们会在地形更有趣的地方采集更多样本。例如,我们将对山区进行比平原更密集的采样。但我们在抽样方面肯定有一些选择,如果可以简化问题,甚至可以抽样。唯一的问题是
我们不知道需要绘制多少地形才能找到我们正在寻找的要素。
取样的费用适中,大约需要 10 分钟。因此,对 100x100 网格进行采样可能需要很长时间。
I need to make a topographic map of a terrain for which I have only fairly sparse samples of (x, y, altitude) data. Obviously I can't make a completely accurate map, but I would like one that is in some sense "smooth". I need to quantify "smoothness" (probably the reciprocal the average of the square of the surface curvature) and I want to minimize an objective function that is the sum of two quantities:
- The roughness of the surface
- The mean square distance between the altitude of the surface at the sample point and the actual measured altitude at that point
Since what I actually want is a topographic map, I am really looking for a way to construct contour lines of constant altitude, and there may be some clever geometric way to do that without ever having to talk about surfaces. Of course I want contour lines also to be smooth.
Any and all suggestions welcome. I'm hoping this is a well-known numerical problem. I am quite comfortable in C and have a working knowledge of FORTRAN. About Matlab and R I'm fairly clueless.
Regarding where our samples are located: we're planning on roughly even spacing, but we'll take more samples where the topography is more interesting. So for example we'll sample mountainous regions more densely than a plain. But we definitely have some choices about sampling, and could take even samples if that simplifies matters. The only issues are
We don't know how much terrain we'll need to map in order to find features that we are looking for.
Taking a sample is moderately expensive, on the order of 10 minutes. So sampling a 100x100 grid could take a long time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
克里金插值可能对平滑插值稀疏样本有一定用处。
Kriging interpolation may be of some use for smoothly interpolating your sparse samples.
R 有许多不同的相关工具。特别是空间视图。类似的问题 之前在 R-Help 中被问过,所以你可能想看看。
查看
contour
函数。以下是一些数据:初始绘图有些粗糙:
Bill Dunlap 建议改进:“将光滑表面拟合到数据上,在更精细的网格上评估该表面,并将结果传递给轮廓,效果通常会更好。这可以确保轮廓线不会相互交叉,并且往往会避免因平滑轮廓线本身而产生的虚假循环。薄板样条线(来自库(“字段”)的 Tps)和黄土(以及其他)可以适合表面。”
这会产生非常平滑的绘图,因为它首先使用
Tps()
来拟合数据,然后调用contour
。它最终看起来像这样(如果您希望它有阴影,您也可以使用filled.contour):对于绘图,您可以使用
lattice
(如上例所示)或ggplot2
包。在这种情况下,请使用 geom_contour() 函数。可以在此处找到示例(ht Thierry):R has many different relevant tools. In particular, have a look at the spatial view. A similar question was asked in R-Help before, so you may want to look at that.
Look at the
contour
functions. Here's some data:An initial plot is somewhat rough:
Bill Dunlap suggested an improvement: "It often works better to fit a smooth surface to the data, evaluate that surface on a finer grid, and pass the result to contour. This ensures that contour lines don't cross one another and tends to avoid the spurious loops that you might get from smoothing the contour lines themselves. Thin plate splines (Tps from library("fields")) and loess (among others) can fit the surface."
This results in a very smooth plot, because it uses
Tps()
to fit the data first, then callscontour
. It ends up looking like this (you can also use filled.contour if you want it to be shaded):For the plot, you can use either
lattice
(as in the above example) or theggplot2
package. Use thegeom_contour()
function in that case. An example can be found here (ht Thierry):对轮廓算法的精彩回顾,您可能需要先对表面进行网格化才能插值到网格上。
Excellent review of contouring algorithm, you might need to mesh the surface first to interpolate onto a grid.
也许你可以使用:
与
R
maybe you can use:
with
in R