如何从高程栅格近似矢量轮廓?

发布于 2024-07-13 15:01:41 字数 518 浏览 9 评论 0 原文

我有一张以栅格形式存储的高程图。 我想将平滑的“矢量”曲线拟合到恒定高程的轮廓。 在我的应用程序中,数据实际上是地理海拔,但问题可以推广到两个变量的任何函数。

我可以生成另一个具有抗锯齿轮廓线的栅格,并将其用作矢量拟合过程的输入(如果有帮助的话)。

这个问题类似,但我正在寻找一个我可以在我的 Java 应用程序中使用的免费库,或者我(非数学家)可以自己实现的算法的解释。 另外,就我而言,我已经找到了我关心的所有“边缘”——我只需要对它们进行矢量化即可。

另一个问题涉及到我的问题,但发帖者从未返回解释他如何实现最后一步,这是我缺少的部分。

I have an elevation map stored as a raster. I'd like to fit a smooth "vector" curve to the contours of constant elevation. In my application, the data are actually geographic elevations, but the problem could be generalized to any function of two variables.

I can produce another raster with anti-aliased contour lines, and use that as input to the vector-fitting process, if that helps.

This question is similar, but I'm looking for a free library that I can use in my Java application, or an explanation of the algorithm I (a non-mathematician) can implement myself. Also, in my case, I've already found all of the "edges" I care about—I just need to vectorize them.

Another question touches on mine, but the poster never returned to explain how he implemented the final step, which is the part I'm missing.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

征棹 2024-07-20 15:01:41

您可能想要拟合闭合贝塞尔样条曲线(曲线)。

有一个 带有 Java 小程序的页面做这样的拟合。 看看他们的(未注释的,该死的)PSegment.java

如果这还不够好,将 B 样条曲线拟合到点云
平方距离最小化
对于这项任务来说应该是大材小用。

有关更多信息,Google(学术)搜索“b 样条拟合”和“闭合贝塞尔样条”等内容应该会有所帮助。

You probably want to fit to closed bezier splines (curves).

There is a page with a Java applet that does such fitting. Take a look at their (uncommented, bleh) PSegment.java

If that doesn't do the job well enough, Fitting B-Spline Curves to Point Clouds by
Squared Distance Minimization
should be overkill for the task.

For more info, Google (Scholar) searches for things like "b-spline fitting" and "closed bezier spline" should help.

深爱成瘾 2024-07-20 15:01:41

MATLAB 通过等高线图来完成此操作:请参阅 等高线 函数——它从 f(x,y) 数据网格生成等高线数据。 我不太了解他们使用的算法(他们确实有 讨论它的页面),但也许值得一看 八度等效

有一篇关于等高线绘图的论文和一篇基于论文的 CodeProject 页面

MATLAB does this with a contour plot: see the contour function -- it produces contour line data from a grid of f(x,y) data. I don't know much about the algorithm they use (they do have a page which discusses it) but maybe worth looking at the Octave equivalent.

there's a thesis on contour plotting and a CodeProject page based on the thesis.

浊酒尽余欢 2024-07-20 15:01:41

我使用 GDAL。 在我看来,您可能不想创建贝塞尔样条线,这会增加复杂性。 短线段就足够了。

唯一的问题是您必须在数据准备时创建轮廓,而不是在 Java 应用程序中。

这是一张由 USGS 创建的一些轮廓的地图使用 GDAL 的高度数据

在此处输入图像描述

I use GDAL. And in my opinion you probably don't want to create Bézier splines, which adds complexity. Short line segments are good enough.

The only problem is that you'd have to create the contours at data preparation time, not in your Java app.

Here's a map with some contours created from USGS height data using GDAL:

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文