1
我正在使用sift实现以及在“用Python编程计算机视觉”中找到的代码。Python:绘制筛选点返回点关闭图片
在使用中vision.py的plotMatches功能(相当于plot_matches()函数书),一些绘制点都连上的图像:
正如你所看到的,大部分要点都不在图片上。
这可能是一个变化,我不得不让我plotMatches的结果()函数:
for i, m in enumerate(matchscores):
if i > 0:
lab.plot([locs1[i][1], locs2[i][1] + cols1],
[locs1[i][0], locs2[i][0]], 'c')
原始代码:
for i, m in enumerate(matchscores):
if i > 0:
lab.plot([locs1[i][1], locs2[m][1] + cols1],
[locs1[i][0], locs2[m][0]], 'c')
将引发以下错误:
Traceback (most recent call last):
File "/home/peter-brown/AI/Markus/ImageRecognition.py", line 37, in <module>
sch.plotMatches(image, image2, l1, l2, matches, show_below=False)
File "/home/peter-brown/AI/Markus/vision.py", line 199, in plotMatches
lab.plot([locs1[i][1], locs2[m][1] + cols1],
IndexError: index 1 is out of bounds for axis 0 with size 1
通过更改代码中使用的任何'm',该程序将工作,但它会输出不正确。
为什么输出与图像不对应,以及如何更改plotMatches函数来工作?