最近的Neigbor搜索 - 根据位置找到哪些值不合适

发布于 2025-02-08 08:38:02 字数 521 浏览 0 评论 0原文

我目前正在研究C ++程序,该程序分析了与最后一帧相比,当前帧中检测到的位置。如果在当前框架中检测到一个或多个位置的情况下,我需要估计哪些对象是新的。为此,我无法简单地发现哪些值与所有其他值最远,因为它不够准确。

示例:

vector<float> currentFramePosition = {0.08, 0.19, 0.22, 0.56, 0.7, 0.9};
vector<float> lastFramePosition = {0.09, 0.23, 0.52, 0.8, 0.98};

在此示例中,我们可以看到有一个新值。如果我们假设距离最后一个帧值最远的值,我们会发现新值是第四索引处的0.7。如果我们客观地看待它,则新值应为0.19,如果要最大程度地减少总距离。如果我们与0.19匹配0.23,则最接近0.22的距离将为0.52,并且该距离大于0.7和0.8之间的距离。
。 每个帧中可能有多个新值。

有没有办法找到哪些值是新的,而没有函数过于时间复杂?

谢谢!

I am currently working on a program in C++ which analyzes positions detected in the current frame compared to the last frame. In the case where one or more position is detected in the current frame, I need to estimate which objects are new. To do this, I can't simply find which values are the furthest from all other values as it isn't accurate enough.

Example:

vector<float> currentFramePosition = {0.08, 0.19, 0.22, 0.56, 0.7, 0.9};
vector<float> lastFramePosition = {0.09, 0.23, 0.52, 0.8, 0.98};

In this example, we can see that there is one new value. If we assume the value that is the furthest away from the last frame's values we get that the new value is the 0.7 at the 4th index. If we look at it objectively the new value should be 0.19 if we want to minimize the total distance. If we match 0.19 with 0.23, 0.22's closest value will be 0.52 and that distance is bigger than the distance between 0.7 and 0.8.
There can be more than one new value in each frame.

Is there a way to find which values are new without the function being too time complex?

Thanks!

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

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

发布评论

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

评论(1

可是我不能没有你 2025-02-15 08:38:02

解决此问题的一种方法是将其构架为最小重量的匹配问题。具体来说,您正在尝试将旧框架中的项目与新框架中的项目配对,以最大程度地减少匹配点之间的总距离。有许多标准算法可以在合理的时间内解决此问题。匈牙利算法可能是最著名的,但是您应该能够找到一套现有的高效库,这些图书馆将计算最小的两部分匹配。

One way of solving this would be to frame it as a minimum-weight bipartite matching problem. Specifically, you’re trying to pair off items in the old frame with items in the new frame in a way that minimizes the total distance between the matched points. There are many standard algorithms for solving this problem in a reasonable amount of time. The Hungarian algorithm is probably the most famous, but you should be able to find an existing set of efficient libraries that will compute minimum-weight bipartite matchings.

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