平滑从 CoreLocation 接收的数据

发布于 2024-10-25 03:16:13 字数 174 浏览 2 评论 0原文

我正在尝试开发一个应用程序,它可以让你四处走动,并且你走过的地方会被绘制在地图上。我已经一切正常,但我发现即使有相当准确的 GPS 位置,这些点仍然会有点跳动。当在地图上绘制时,这会产生创建波浪线或锯齿线的效果。

我正在寻找有关如何平滑数据的建议/策略,以便地图上绘制的线条更加平滑、最佳拟合,而不是精确的点对点绘制。

I'm trying to develop an app which allows you to walk around, and where you walked will be drawn on a map. I have this all working fine, but I'm finding that even with a reasonably accurate GPS location the points still jump around a bit. When drawn on a map this has the effect of creating a squiggly or zig-zag line.

I'm looking for suggestions/strategies on how to smooth the data, so that the line drawn on the map is more of a smooth best fit, rather than an accurate point to point drawing.

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

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

发布评论

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

评论(1

就像说晚安 2024-11-01 03:16:13

您可以对数据应用许多不同类型的平滑算法(有关一些起点,请参阅这篇维基百科文章)。确定哪些方法适合您的应用程序的唯一方法是实施和测试它们。

简单或加权移动平均线相当常见(获取最后n个样本并对它们求平均值),但存在滞后于数据的问题。过滤信号噪声的一种常见方法是高通滤波器,它可以在通过较大的运动时衰减较小的(有噪声的)运动。 Apple 在其 AccelerometerGraph 示例中提供了一些相关代码。

我建议先尝试这些,因为它们很容易实现,然后再考虑移动复杂的。

There are many different types of smoothing algorithms you could apply to the data (for a few starting points, see this Wikipedia article). The only way to know for sure which is/are suitable for your application is to implement and test them.

Simple or weighted moving averages are fairly common (taking the last n samples and averaging them), but have the problem of lagging behind the data. A common one for filtering signal noise is a high-pass filter, which attenuates small (noisy) movements while passing through larger ones. Apple has some code for this in their AccelerometerGraph sample.

I'd suggest trying those out first as they're easy to implement, before looking at the move complex ones.

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