久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

模塊'對(duì)象沒(méi)有屬性'drawMatches'opencv pyth

module#39; object has no attribute #39;drawMatches#39; opencv python(模塊對(duì)象沒(méi)有屬性drawMatchesopencv python)
本文介紹了模塊'對(duì)象沒(méi)有屬性'drawMatches'opencv python的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

我只是在 OpenCV 中做一個(gè)特征檢測(cè)的例子.此示例如下所示.它給了我以下錯(cuò)誤

I am just doing an example of feature detection in OpenCV. This example is shown below. It is giving me the following error

模塊'對(duì)象沒(méi)有屬性'drawMatches'

我檢查了 OpenCV 文檔,但不確定為什么會(huì)出現(xiàn)此錯(cuò)誤.有誰(shuí)知道為什么?

I have checked the OpenCV Docs and am not sure why I'm getting this error. Does anyone know why?

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()

錯(cuò)誤:

Traceback (most recent call last):
File "match.py", line 22, in <module>
img3 = cv2.drawMatches(img1,kp1,img2,kp2,matches[:10], flags=2)
AttributeError: 'module' object has no attribute 'drawMatches'

推薦答案

drawMatches 函數(shù)不是 Python 接口的一部分.
正如您在 docs 中看到的,它僅定義為C++ 目前.

The drawMatches Function is not part of the Python interface.
As you can see in the docs, it is only defined for C++ at the moment.

文檔摘錄:

 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 )

如果函數(shù)有 Python 接口,你會(huì)發(fā)現(xiàn)類(lèi)似這樣的內(nèi)容:

If the function had a Python interface, you would find something like this:

 Python: cv2.drawMatches(img1, keypoints1, [...]) 

編輯

實(shí)際上有一個(gè) commit 介紹了這個(gè)函數(shù).但是,它(還沒(méi)有)在官方文檔中.
確保您使用的是最新的 OpenCV 版本 (2.4.7).為了完整起見(jiàn),OpenCV 3.0.0 的函數(shù)接口看起來(lái)像 這個(gè):

There actually was a commit that introduced this function 5 months ago. However, it is not (yet) in the official documentation.
Make sure you are using the newest OpenCV Version (2.4.7). For sake of completeness the Functions interface for OpenCV 3.0.0 will looks like this:

cv2.drawMatches(img1, keypoints1, img2, keypoints2, matches1to2[, outImg[, matchColor[, singlePointColor[, matchesMask[, flags]]]]]) → outImg

這篇關(guān)于模塊'對(duì)象沒(méi)有屬性'drawMatches'opencv python的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How to draw a rectangle around a region of interest in python(如何在python中的感興趣區(qū)域周?chē)L制一個(gè)矩形)
How can I detect and track people using OpenCV?(如何使用 OpenCV 檢測(cè)和跟蹤人員?)
How to apply threshold within multiple rectangular bounding boxes in an image?(如何在圖像的多個(gè)矩形邊界框中應(yīng)用閾值?)
How can I download a specific part of Coco Dataset?(如何下載 Coco Dataset 的特定部分?)
Detect image orientation angle based on text direction(根據(jù)文本方向檢測(cè)圖像方向角度)
Detect centre and angle of rectangles in an image using Opencv(使用 Opencv 檢測(cè)圖像中矩形的中心和角度)
主站蜘蛛池模板: 久久久国产一区二区 | 日本三级全黄三级三级三级口周 | 精品无码三级在线观看视频 | 国产一区二区在线免费观看 | 久久久av | 91亚洲精选| 中文在线a在线 | 国产激情在线 | 欧美一区二不卡视频 | 国产精品色av | 国产一区二区在线视频 | 久久av网站 | 成人精品国产 | 亚洲一av | 精品国产一区二区三区久久久四川 | 亚洲激情一区二区 | 四虎影院在线播放 | 久久久久国产一级毛片高清网站 | 操操日| 国产高清视频 | 日韩国产在线 | 国产精品国产三级国产aⅴ中文 | 99综合| 亚洲视频在线观看一区二区三区 | 黄色a级一级片 | 九色porny自拍视频 | 久久久久九九九女人毛片 | 国产精品一级 | 国产一区二区影院 | 精品一区二区久久久久久久网站 | av黄色免费 | 中国一级特黄视频 | 波多野结衣电影一区 | 激情欧美日韩一区二区 | 在线视频成人 | 国产精品久久久久久久免费观看 | japan25hdxxxx日本| 欧美寡妇偷汉性猛交 | 国产真实精品久久二三区 | 精品www | 黄色大片毛片 |