我只是在OpenCV中做一个特征检测的例子.此示例如下所示.它给了我以下错误
module'对象没有属性'drawMatches'
我检查了OpenCV Docs,我不确定为什么会收到此错误.有谁知道为什么?
import numpy as np
import cv2
import matplotlib.pyplot as plt
img1 = cv2.imread('box.png',0) # queryImage
img2 = cv2.imread('box_in_scene.png',0) # trainImage
# Initiate SIFT detector
orb = cv2.ORB()
# 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)
# Draw first 10 matches.
img3 = cv2.drawMatches(img1,kp1,img2,kp2,matches[:10], flags=2)
plt.imshow(img3),plt.show()
Run Code Online (Sandbox Code Playgroud)
错误:
Traceback (most recent call last):
File "match.py", line …Run Code Online (Sandbox Code Playgroud)