Python中文
首页
教程
问答
标签
搜索
登录
注册
opencv 3 python函数cv2.detectAndCompute和cv2.compu上的功能检测错误
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我使用opencv 3.0.0和python 2.7.5_x32</p> <p>这是我的代码(ORB功能检测):</p> <pre><code>import numpy as np import cv2 from matplotlib import pyplot as plt img1 = cv2.imread('C:\\Python27\\madar1.jpg',0) # queryImage img2 = cv2.imread('C:\\Python27\\madar2.jpg',0) # trainImage # Initiate SIFT detector orb = cv2.ORB_create() # line 12 # find the keypoints and descriptors with SIFT 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[:10], flags=2) plt.imshow(img3),plt.show() cv2.waitKey() cv2.destroyAllWindows() </code></pre> <p>这是错误信息,错误信息在 kp1,des1=orb.检测和计算(img1,无)部分, 我在opencv 2.4.11上工作过,但在opencv 3.0.0上不工作!</p> <pre><code> Traceback (most recent call last): File "C:\Python27\orb_matcher.py", line 12, in <module> kp1, des1 = orb.detectAndCompute(img1,None) error: ..\..\..\modules\python\src2\cv2.cpp:163: error: (-215) The data should normally be NULL! in function NumpyAllocator::allocate </code></pre> <p>请帮帮我,我该怎么做才能成功?</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>您可以在导入cv2和其他脚本后尝试添加此脚本<code>cv2.ocl.setUseOpenCL(False)</code>这解决了我的问题。</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
如何在Python中简化列表处理?
6 回答
如何在Python中简化多个条件
7 回答
如何在python中简化嵌套列表的字典?
4 回答
如何在python中简化数组
2 回答
如何在python中简化此数据库调用
5 回答
如何在Python中简化这些语句
6 回答
如何在python中简化重复列表的理解?
5 回答
如何在Python中简单地从JSON API捕获空列表?
1 回答
如何在python中简单地使用for
6 回答
如何在Python中简单地导入文件夹?
10 回答
如何在Python中简单地将字符串中的分号对齐?
6 回答
如何在Python中简单地输入隐藏字
9 回答
如何在Python中简洁地级联多个regex语句
2 回答
如何在python中管理“\”,同时将psv加载到postgresq
7 回答
如何在Python中管理/托管AWS SQS队列消费者?
2 回答
如何在Python中管理diy etl管道中的范围
2 回答
如何在python中管理eventhandler递归?
10 回答
如何在Python中管理Google API错误
4 回答
如何在Python中管理全局变量
2 回答
如何在Python中管理内存
7 回答