<p>好吧,伙计们,我是一个新手,在网上研究了几个小时后,我学到了很多东西,这似乎是一个错误,叫做错误(-255)NumpyAllocator,很多网站都会建议你打开cv2.cpp文件,注释掉163行代码,我的建议是如果你使用OpenCV 3.1,把成绩下载到opencv3.0.0</p>
<p>这个bug似乎在OpenCV 3.1中,除此之外,OpenCV.org上记录的使用ORB算法的代码有点过时了
它所说的
<code>enter code here</code>启动ORB探测器
<code>enter code here</code>orb=cv2.orb();注意,您将得到一个错误,因为现在<code>enter code here</code>更改为:
<code>enter code here</code>orb=cv2.orb\u create()</p>
<p>下面是我在Windows10上使用OpenCV3.0.0的代码示例:</p>
<pre><code> # Example of Brute Force matching base on ORB Algorithm
#Modify Author : Waheed Rafiq R&D student Birmingham City University UK
#Original author : OpenCV.org
#Date Updated : 21/04/2016 : 13:45
import numpy as np
import cv2
from matplotlib import pyplot as plt
img1 = cv2.imread('wr-pb.jpg',0) # queryImage
img2 = cv2.imread('Waheed.jpg',0) # trainImage
# Initiate ORB detector
orb = cv2.ORB_create()
# find the keypoints and descriptors with ORB
kp1, des1 = orb.detectAndCompute(img1,None)
kp2, des2 = orb.detectAndCompute(img2,None)
# create BFMatcher object
bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True)
# Match descriptors.
matches = bf.match(des1,des2)
# Sort them in the order of their distance.
matches = sorted(matches, key = lambda x:x.distance)
# Draw first 10 matches.
img3 = cv2.drawMatches(img1,kp1,img2,kp2,matches ,None, flags=2)
plt.imshow(img3),plt.show()
</code></pre>
<p>我希望这对我有帮助,我喜欢堆栈溢出它最好的资源在互联网上。</p>