久久久久久久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è)圖像中矩形的中心和角度)
主站蜘蛛池模板: 亚洲第一天堂网 | 在线中文字幕 | 男男成人高潮片免费网站 | 草草免费视频 | 成人福利在线 | 一区二区不卡 | 黄色小视频免费观看 | 欧美激情成人 | 亚洲一区二区三区在线 | 一区二区三区黄色 | 毛片www| 97视频| 欧美一级片在线播放 | 亚洲最大黄色网址 | 在线观看亚洲一区 | 国产一区中文字幕 | 欧美1区2区 | 天天视频黄 | 黑人精品xxx一区一二区 | 在线观看欧美日韩视频 | 天天干天天干天天干 | 一级看片免费视频 | 中文字幕一区二区三区视频 | 日韩视频免费看 | 日韩欧美高清视频 | 成人在线免费看 | 久久大| 在线婷婷 | 黄色大片在线免费观看 | 在线观看免费av网站 | 国产精品一级 | 黄色av观看 | 黄色影院在线观看 | 黄色免费在线观看视频 | 美女黄色在线观看 | a级片久久 | 免费国产网站 | 免费在线黄色网址 | 亚洲成a人| 久久精品观看 | 国产三级黄色片 |