- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我运行 Flann KNN 匹配器时,有时 KNN 匹配器只返回一个点,因为依赖于两个点的匹配器之后的代码会失败:
flann = cv2.FlannBasedMatcher(index_params, search_params)
matches = flann.knnMatch(descriptors1, descriptors2, k=2)
# Retrieve good matches
good_matches = []
# ratio test as per Lowe's paper
for i, (m, n) in enumerate(matches):
if m.distance < 0.7*n.distance:
good_matches.append((m, n))
抛出这个错误:
Traceback (most recent call last):
File "main.py", line 161, in <module>
main(vid, video_file)
...
File "main.py", line 73, in consume_for_homography_error
matches = flann_matcher(descriptors1, descriptors2)
File "main.py", line 48, in flann_matcher
for i, (m, n) in enumerate(matches):
ValueError: need more than 1 value to unpack
这里似乎有什么问题?
最佳答案
问题是匹配项似乎填充为固定长度的列表列表,在本例中 len(matches) == 500
即使找到的匹配项数量少于该数量。
尝试添加这个:
matches = [match for match in matches if len(match) == 2]
(or even better)
good_matches = [match[0] for match in matches if len(match) == 2 and match[0].distance
< .7*match[1].distance]
before the for loop to delete these (empty lists?).
关于python - OpenCV 中的 Flann KNN Matcher 只返回一个点而不是一对,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31291993/
http://opencv.willowgarage.com/documentation/cpp/features2d_common_interfaces_of_descriptor_matchers
我正在尝试运行检测图像特征的应用程序,但是当我运行 BRISK 的代码时功能,BRIEF描述符和 FlannBased匹配器,它崩溃并说: OpenCV Error: Unsupported form
我编写了一个程序来计算 SURF 特征,然后使用 FLANN(最近邻快速库)来匹配和显示最近邻。现在可以将 FLANN 的使用视为使用机器学习,因为我的理解是它是 k-最近邻搜索的近似版本,被视为机器
我正在尝试将 FLANN 与 ORB 描述符一起使用,但 opencv 会因以下简单代码而崩溃: vector > dbKeypoints; vector dbDescriptors; vector
还是用flann可能?我不是最有经验的编码员,我可能也只是忽略了一些基本的东西(C++,OpenCV 2.4.3)。 问题 : 我有两个点云,想要计算位移图。我正在尝试使用flann .lib从第二个
我正在尝试在大型 3D 点数据集中查找相邻节点的确切数量。目标是让数据集的每个点检索具有给定半径的区域中所有可能的邻居。 FLANN 确保对于低维数据可以检索到确切的邻居,而与蛮力搜索相比,情况似乎并
将所有描述符添加到 FLANN 索引后,我使用以下代码保存它: flann = cv2.flann.Index() for index, filename in enumerate(o
我一直在尝试设置一个基本的 3D 点 flann knnsearch,但到目前为止还没有成功地让它工作。我尝试了很多不同的东西,但都返回了错误。有一段时间我遇到了 cv::flann::Index k
您好,我正在尝试对整数数据进行最近邻查询。似乎 cv::flann 不支持这个。这是真的吗? 最佳答案 是的,可以对整数数据使用 FLANN 最近邻搜索。您需要对整数使用距离度量。一些距离度量是模板,
我有一张全景图,以及在该全景图中看到的建筑物的较小图像。我想要做的是识别那个较小图像中的建筑物是否在那个全景图像中,以及这 2 个图像如何排列。 对于第一个示例,我使用的是全景图像的裁剪版本,因此像素
我正在使用 opencv 2.4.4 flann。 我指的是:http://docs.opencv.org/2.4.4/modules/flann/doc/flann_fast_approximate
这正常吗?当我尝试暴力匹配器时,结果每次都是一致的,但 flann 不是。少量的关键点会匹配到不同的地方。我正在使用 Android 包装器编写代码,关键点检测器和描述符是 SURF,如下所示: Ma
我将 flann 与使用大量 RAM 的大型索引一起使用。 我希望能够在多个进程之间共享 flann 索引。 是否可以让 flann 使用内存映射文件作为其索引,以便在多个进程之间共享? 最佳答案 我
我想利用 FLANN 库进行多标签分类。我知道 FLANN 库用于计算最近邻,但我不确定如何将它用于分类目的。有没有办法将其插入 Scikit-Learn 或其他库中。 最佳答案 FLANN写在 c+
我尝试用cmake编译FLANN,但唯一的结果就是头疼。 所以我找到了here这个解决方案通过 PCL 存储库和突触。安装似乎很顺利,但现在我不知道如何使用安装的包。 引用 FLANN 的 docum
编辑(感谢 Barry 的评论)我需要复制 FLANN 搜索索引以在 vector 中使用它们,但是当拷贝超出范围时它会产生访问冲突。崩溃的最小代码是: #include #include const
我想做半径搜索来找到所有有效的邻居,但它似乎给了我错误的结果。这是我的代码 #include "opencv/cv.hpp" #include #include int main () {
我正在编写一个基于 surf 的图像匹配算法。我用 400 hessian 阈值初始化 surf: surf = cv2.SURF(400) 并进行了 flann 匹配。 但它运行得太慢(在大量图像上
我写了一个程序来匹配两张图片。这是代码。但如果我使用 BruteForceMatcher>(不是 flann),它就可以工作。 #include #include "opencv2/core/cor
我有一组点云(点云数≈200万)。我想为点群中的每个点找到最近的 k 邻居。我做了这样的事情 flann::Index flann_index(data_m, flann::KDTreeIndexPa
我是一名优秀的程序员,十分优秀!