【发布时间】:2025-12-01 06:00:01
【问题描述】:
当我运行 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
这里似乎有什么问题?
【问题讨论】:
-
你找到解决这个问题的方法了吗?
标签: python python-2.7 opencv flann