<p><code>drawMatches</code>函数不是Python接口的一部分。<br/>
正如您在<a href="http://docs.opencv.org/modules/features2d/doc/drawing_function_of_keypoints_and_matches.html#drawmatches" rel="noreferrer">docs</a>中看到的,目前它只为<code>C++</code>定义。</p>
<p>文件摘录:</p>
<pre><code> C++: void drawMatches(const Mat& img1, const vector<KeyPoint>& keypoints1, const Mat& img2, const vector<KeyPoint>& keypoints2, const vector<DMatch>& matches1to2, Mat& outImg, const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1), const vector<char>& matchesMask=vector<char>(), int flags=DrawMatchesFlags::DEFAULT )
C++: void drawMatches(const Mat& img1, const vector<KeyPoint>& keypoints1, const Mat& img2, const vector<KeyPoint>& keypoints2, const vector<vector<DMatch>>& matches1to2, Mat& outImg, const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1), const vector<vector<char>>& matchesMask=vector<vector<char> >(), int flags=DrawMatchesFlags::DEFAULT )
</code></pre>
<p>如果函数有一个Python接口,您会发现如下内容:</p>
<pre><code> Python: cv2.drawMatches(img1, keypoints1, [...])
</code></pre>
<p><strong>编辑</strong></p>
<p>实际上有一个<a href="https://github.com/Itseez/opencv/commit/5d863f75160c345c1dbc15d00a88762f68c8b60f#diff-17a1c50caf639a7abe392c3dfb1a1fdb" rel="noreferrer">commit</a>在5个月前引入了这个函数。但是,官方文件中还没有
确保您使用的是最新的OpenCV版本(2.4.7)。
为了完整起见,OpenCV 3.0.0的函数接口看起来像<a href="http://docs.opencv.org/trunk/modules/features2d/doc/drawing_function_of_keypoints_and_matches.html?highlight=drawmatch#cv2.drawMatches" rel="noreferrer">this</a>:</p>
<pre><code>cv2.drawMatches(img1, keypoints1, img2, keypoints2, matches1to2[, outImg[, matchColor[, singlePointColor[, matchesMask[, flags]]]]]) → outImg
</code></pre>