当我运行 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
这里似乎有什么问题?