OpenCV 4.12.0
開源計算機視覺
載入中...
搜尋中...
無匹配項
關鍵點與匹配的繪製函式

詳細描述

列舉

cv::Paramcv::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 image, const std::vector< KeyPoint > &keypoints, InputOutputArray outImage, const Scalar &color=Scalar::all(-1), 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 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)
 

列舉型別文件

◆ DrawMatchesFlags

enum struct cv::DrawMatchesFlags
strong

#include <opencv2/features2d.hpp>

列舉器
DEFAULT 

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

DRAW_OVER_OUTIMG 

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

NOT_DRAW_SINGLE_POINTS 

單個關鍵點將不會被繪製。

DRAW_RICH_KEYPOINTS 

對於每個關鍵點,將繪製圍繞關鍵點的圓圈,包括關鍵點大小和方向。

函式文件

◆ drawKeypoints()

void cv::drawKeypoints ( InputArray image,
const std::vector< KeyPoint > & keypoints,
InputOutputArray outImage,
const Scalar & color = Scalar::all(-1),
DrawMatchesFlags flags = DrawMatchesFlags::DEFAULT )
Python
cv.drawKeypoints(image, keypoints, outImage[, color[, flags]]) -> outImage

#include <opencv2/features2d.hpp>

繪製關鍵點。

引數
image源影像。
keypoints來自源影像的關鍵點。
outImage輸出影像。其內容取決於標誌值,該值定義了在輸出影像中繪製的內容。請參閱下面可能的標誌位值。
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 flags = 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 flags = 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==Scalar::all(-1) ,則隨機生成顏色。
singlePointColor單個關鍵點(圓圈)的顏色,這意味著關鍵點沒有匹配項。 如果 singlePointColor==Scalar::all(-1) ,則隨機生成顏色。
匹配掩碼確定繪製哪些匹配項的掩碼。 如果掩碼為空,則繪製所有匹配項。
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 flags = 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