![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
OpenCV官方教程--个人问题集
yuxuan_08
这个作者很懒,什么都没留下…
展开
-
Python3 TypeError: slice indices must be integers or None or have an __index__ method
在使用Python3进行矩阵操作时,当内部含有除法时结果的是浮点型,与原数据类型不一致,会产生错误:TypeError: slice indices must be integers or None or have an __index__ methodcrow,ccol = rows/2 , cols/2mask = np.zeros((rows,cols,2),np.uint8)解...原创 2019-02-27 09:51:44 · 755 阅读 · 0 评论 -
Python3 AttributeError: module 'cv2' has no attribute 'SIFT'
问题:在用python3使用sift = cv2.SIFT()进行SIFT时候,可能会产生错误:AttributeError: module 'cv2' has no attribute 'SIFT'import numpy as npimport cv2from matplotlib import pyplot as pltimg1 = cv2.imread('data/queryI...原创 2019-02-27 09:53:00 · 5661 阅读 · 1 评论 -
python3 TypeError: Incorrect type of self (must be 'Feature2D' or its derivative)
问题:在用python3使用orb = cv2.ORB()进行ORB时候,可能会产生错误:TypeError: Incorrect type of self (must be 'Feature2D' or its derivative)import numpy as npimport cv2from matplotlib import pyplot as pltimg1 = cv2.i...原创 2019-02-27 09:53:48 · 1226 阅读 · 0 评论 -
Python3 TypeError: Required argument 'outImg' (pos 6) not found
问题:在用python3使用img3 = cv2.drawMatchesKnn(img1,kp1,img2,kp2,good,flags=2)的时候,可能会产生错误:TypeError: Required argument 'outImg' (pos 6) not foundimport numpy as npimport cv2from matplotlib import pyplot...原创 2019-02-27 09:54:37 · 1285 阅读 · 0 评论 -
Python3 AttributeError: module 'cv2' has no attribute 'createBackgroundSubtractorMOG'
问题:在用python3使用cv2.createBackgroundSubtractorMOG()的时候,可能会产生错误:AttributeError: module 'cv2' has no attribute 'createBackgroundSubtractorMOG'import numpy as npimport cv2cap = cv2.VideoCapture(0)fgb...原创 2019-02-27 09:55:18 · 1278 阅读 · 1 评论 -
Python3 AttributeError: module 'cv2' has no attribute 'KNearest'
问题:在用python3使用knn = cv2.KNearest()的时候,可能会产生错误:AttributeError: module 'cv2' has no attribute 'KNearest'newcomer = np.random.randint(0, 100, (1, 2)).astype(np.float32)plt.scatter(newcomer[:, 0], new...原创 2019-02-27 09:56:34 · 1241 阅读 · 0 评论 -
Python3 TypeError: only size-1 arrays can be converted to Python scalars
问题:在用python3使用knn.train(trainData, responses)的时候,可能会产生错误:TypeError: only size-1 arrays can be converted to Python scalarsnewcomer = np.random.randint(0, 100, (1, 2)).astype(np.float32)plt.scatter(...原创 2019-02-27 09:57:08 · 8572 阅读 · 0 评论 -
Python3 AttributeError: 'cv2.ml_KNearest' object has no attribute 'find_nearest'
问题:在用python3使用knn.find_nearest(newcomer, 3)的时候,可能会产生错误:AttributeError: 'cv2.ml_KNearest' object has no attribute 'find_nearest'ret, results, neighbours, dist = knn.find_nearest(newcomer, 3)print("...原创 2019-02-27 09:58:04 · 569 阅读 · 0 评论