OpenCV 4.13.0
開源計算機視覺庫 (Open Source Computer Vision)
正在載入...
正在搜尋...
未找到匹配項
繪製關鍵點和匹配項函式

詳細說明

列舉

enum struct  cv::DrawMatchesFlags {
  cv::DrawMatchesFlags::DEFAULT = 0 ,
  cv::DrawMatchesFlags::DRAW_OVER_OUTIMG = 1 ,
  cv::DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS = 2 ,
  cv::DrawMatchesFlags::DRAW_RICH_KEYPOINTS = 4
}
 

函式

void cv::drawKeypoints (InputArray 影像, const std::vector< KeyPoint > &關鍵點, InputOutputArray 輸出影像, const Scalar &顏色=Scalar::all(-1), DrawMatchesFlags 標誌=DrawMatchesFlags::DEFAULT)
 繪製關鍵點。
 
void cv::drawMatches (InputArray img1, const std::vector< KeyPoint > &keypoints1, InputArray img2, const std::vector< KeyPoint > &keypoints2, const std::vector< DMatch > &matches1to2, InputOutputArray outImg, const int matchesThickness, const Scalar &matchColor=Scalar::all(-1), const Scalar &singlePointColor=Scalar::all(-1), const std::vector< char > &matchesMask=std::vector< char >(), DrawMatchesFlags flags=DrawMatchesFlags::DEFAULT)
 
void cv::drawMatches (InputArray img1, const std::vector< KeyPoint > &keypoints1, InputArray img2, const std::vector< KeyPoint > &keypoints2, const std::vector< DMatch > &matches1to2, InputOutputArray outImg, const Scalar &matchColor=Scalar::all(-1), const Scalar &singlePointColor=Scalar::all(-1), const std::vector< char > &matchesMask=std::vector< char >(), DrawMatchesFlags flags=DrawMatchesFlags::DEFAULT)
 繪製兩張影像中找到的關鍵點匹配項。
 
void cv::drawMatches (InputArray img1, const std::vector< KeyPoint > &keypoints1, InputArray img2, const std::vector< KeyPoint > &keypoints2, const std::vector< std::vector< DMatch > > &matches1to2, InputOutputArray outImg, const Scalar &matchColor=Scalar::all(-1), const Scalar &singlePointColor=Scalar::all(-1), const std::vector< std::vector< char > > &matchesMask=std::vector< std::vector< char > >(), DrawMatchesFlags flags=DrawMatchesFlags::DEFAULT)
 

列舉型別文件 (Enumeration Type Documentation)

◆ DrawMatchesFlags

enum struct cv::DrawMatchesFlags
strong

#include <opencv2/features2d.hpp>

列舉值 (Enumerator)
DEFAULT 

輸出影像矩陣將被建立(Mat::create),即輸出影像的現有記憶體可能會被重用。將繪製兩個源影像、匹配項和單個關鍵點。對於每個關鍵點,只繪製中心點(沒有帶有關鍵點大小和方向的圓圈)。

DRAW_OVER_OUTIMG 

輸出影像矩陣不會被建立(Mat::create)。匹配項將繪製在輸出影像的現有內容上。

NOT_DRAW_SINGLE_POINTS 

將不繪製單個關鍵點。

DRAW_RICH_KEYPOINTS 

對於每個關鍵點,將繪製帶有關鍵點大小和方向的圓圈。

函式文件 (Function Documentation)

◆ drawKeypoints()

void cv::drawKeypoints ( InputArray 影像,
const std::vector< KeyPoint > & keypoints,
InputOutputArray 輸出影像,
const Scalar & 顏色 = Scalar::all(-1),
DrawMatchesFlags 標誌 = DrawMatchesFlags::DEFAULT )
Python
cv.drawKeypoints(影像, 關鍵點, 輸出影像[, 顏色[, 標誌]]) -> 輸出影像

#include <opencv2/features2d.hpp>

繪製關鍵點。

引數
影像源影像。
keypoints來自源影像的關鍵點。
輸出影像輸出影像。其內容取決於標誌值,該值定義了在輸出影像中繪製的內容。請參閱下文可能的標誌位值。
color關鍵點的顏色。
flags (標誌)設定繪圖功能的標誌。可能的標誌位值由 DrawMatchesFlags 定義。詳情請參閱 drawMatches 中的說明。
注意
對於 Python API,標誌修改為 cv.DRAW_MATCHES_FLAGS_DEFAULT, cv.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS, cv.DRAW_MATCHES_FLAGS_DRAW_OVER_OUTIMG, cv.DRAW_MATCHES_FLAGS_NOT_DRAW_SINGLE_POINTS

◆ drawMatches() [1/3]

void cv::drawMatches ( InputArray img1,
const std::vector< KeyPoint > & keypoints1,
InputArray img2,
const std::vector< KeyPoint > & keypoints2,
const std::vector< DMatch > & matches1to2,
InputOutputArray outImg,
const int matchesThickness,
const Scalar & matchColor = Scalar::all(-1),
const Scalar & singlePointColor = Scalar::all(-1),
const std::vector< char > & matchesMask = std::vector< char >(),
DrawMatchesFlags 標誌 = DrawMatchesFlags::DEFAULT )
Python
cv.drawMatches(img1, keypoints1, img2, keypoints2, matches1to2, outImg[, matchColor[, singlePointColor[, matchesMask[, flags]]]]) -> outImg
cv.drawMatches(img1, keypoints1, img2, keypoints2, matches1to2, outImg, matchesThickness[, matchColor[, singlePointColor[, matchesMask[, flags]]]]) -> outImg
cv.drawMatchesKnn(img1, keypoints1, img2, keypoints2, matches1to2, outImg[, matchColor[, singlePointColor[, matchesMask[, flags]]]]) -> outImg

#include <opencv2/features2d.hpp>

這是一個過載的成員函式,為方便起見而提供。它與上述函式的區別僅在於所接受的引數不同。

◆ drawMatches() [2/3]

void cv::drawMatches ( InputArray img1,
const std::vector< KeyPoint > & keypoints1,
InputArray img2,
const std::vector< KeyPoint > & keypoints2,
const std::vector< DMatch > & matches1to2,
InputOutputArray outImg,
const Scalar & matchColor = Scalar::all(-1),
const Scalar & singlePointColor = Scalar::all(-1),
const std::vector< char > & matchesMask = std::vector< char >(),
DrawMatchesFlags 標誌 = DrawMatchesFlags::DEFAULT )
Python
cv.drawMatches(img1, keypoints1, img2, keypoints2, matches1to2, outImg[, matchColor[, singlePointColor[, matchesMask[, flags]]]]) -> outImg
cv.drawMatches(img1, keypoints1, img2, keypoints2, matches1to2, outImg, matchesThickness[, matchColor[, singlePointColor[, matchesMask[, flags]]]]) -> outImg
cv.drawMatchesKnn(img1, keypoints1, img2, keypoints2, matches1to2, outImg[, matchColor[, singlePointColor[, matchesMask[, flags]]]]) -> outImg

#include <opencv2/features2d.hpp>

繪製兩張影像中找到的關鍵點匹配項。

引數
img1第一個源影像。
keypoints1第一個源影像的關鍵點。
img2第二個源影像。
keypoints2第二個源影像的關鍵點。
matches1to2從第一個影像到第二個影像的匹配項,這意味著 keypoints1[i] 在 keypoints2[matches[i]] 中有對應的點。
outImg輸出影像。其內容取決於標誌值,該值定義了在輸出影像中繪製的內容。請參閱下文可能的標誌位值。
matchColor匹配項(線和連線的關鍵點)的顏色。如果 matchColor==Scalar::all(-1) ,顏色將隨機生成。
singlePointColor單個關鍵點(圓圈)的顏色,表示這些關鍵點沒有匹配項。如果 singlePointColor==Scalar::all(-1) ,顏色將隨機生成。
matchesMask用於確定哪些匹配項將被繪製的掩碼。如果掩碼為空,則繪製所有匹配項。
flags (標誌)設定繪圖功能的標誌。可能的標誌位值由 DrawMatchesFlags 定義。

此函式在輸出影像中繪製兩個影像的關鍵點匹配項。匹配項是連線兩個關鍵點(圓圈)的線。請參閱 cv::DrawMatchesFlags

◆ drawMatches() [3/3]

void cv::drawMatches ( InputArray img1,
const std::vector< KeyPoint > & keypoints1,
InputArray img2,
const std::vector< KeyPoint > & keypoints2,
const std::vector< std::vector< DMatch > > & matches1to2,
InputOutputArray outImg,
const Scalar & matchColor = Scalar::all(-1),
const Scalar & singlePointColor = Scalar::all(-1),
const std::vector< std::vector< char > > & matchesMask = std::vector< std::vector< char > >(),
DrawMatchesFlags 標誌 = DrawMatchesFlags::DEFAULT )
Python
cv.drawMatches(img1, keypoints1, img2, keypoints2, matches1to2, outImg[, matchColor[, singlePointColor[, matchesMask[, flags]]]]) -> outImg
cv.drawMatches(img1, keypoints1, img2, keypoints2, matches1to2, outImg, matchesThickness[, matchColor[, singlePointColor[, matchesMask[, flags]]]]) -> outImg
cv.drawMatchesKnn(img1, keypoints1, img2, keypoints2, matches1to2, outImg[, matchColor[, singlePointColor[, matchesMask[, flags]]]]) -> outImg