import numpy as np
import cv2 as cv
import matplotlib.pyplot as plt
img1 = cv.imread('roblox.jpg',0) # queryImage
img2 = cv.imread('bloxro.jpg',0) # trainImage
orb = cv.ORB_create()
kp1, des1 = orb.detectAndCompute(img1,None)
kp2, des2 = orb.detectAndCompute(img2,None)
bf = cv.BFMatcher(cv.NORM_HAMMING, crossCheck=True)
matches = bf.match(des1,des2)
matches = sorted(matches, key = lambda x:x.distance)
img3 = cv.drawMatches(img1,kp1,img2,kp2,matches[:10], flags=2)
plt.imshow(img3),plt.show()
当它运行时,我收到此错误消息
Traceback (most recent call last):
File "C:\Users\Blake\Desktop\Python3.7\opencvtests.py", line 19, in <module>
img3 = cv.drawMatches(img1,kp1,img2,kp2,matches[:10], flags=2)
类型错误:drawMatches() 缺少必需的参数“outImg”(位置 6)