OpenCV 4.13.0
Open Source Computer Vision
読み込み中...
検索中...
見つかりません
🤖 AIによる機械翻訳(非公式) — これは OpenCV 4.13.0 公式リファレンス(英語)を AI (Claude) で自動翻訳したものです。訳に誤りを含む場合があります。正確な情報は 公式英語版(原文) を参照してください。
キーポイントとマッチングの描画関数

詳細説明

列挙型

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 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)
 2つの画像から検出されたキーポイントのマッチングを描画する。
 
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)。すなわち、出力画像の既存のメモリが再利用される場合がある。2つのソース画像、マッチ、および単一のキーポイントが描画される。各キーポイントについては中心点のみが描画される(キーポイントのサイズと向きを示す、キーポイント周囲の円は描画されない)。

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出力画像。その内容は、出力画像に何を描画するかを定義する flags の値に依存する。指定可能なフラグのビット値については以下を参照。
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>

2つの画像から見つかったキーポイントのマッチを描画する。

引数
img11番目のソース画像。
keypoints11番目のソース画像のキーポイント。
img22番目のソース画像。
keypoints22番目のソース画像のキーポイント。
matches1to21番目の画像から2番目の画像へのマッチ。つまり keypoints1[i] が keypoints2[matches[i]] に対応する点を持つことを意味する。
outImg出力画像。その内容は、出力画像に何を描画するかを定義する flags の値に依存する。指定可能なフラグのビット値については以下を参照。
matchColorマッチ(線と接続されたキーポイント)の色。matchColor==Scalar::all(-1) の場合、色はランダムに生成される。
singlePointColor単一のキーポイント(円)の色。これはマッチを持たないキーポイントを意味する。singlePointColor==Scalar::all(-1) の場合、色はランダムに生成される。
matchesMaskどのマッチを描画するかを決定するマスク。マスクが空の場合、すべてのマッチが描画される。
flags描画する特徴を設定するフラグ。指定可能なフラグのビット値は DrawMatchesFlags で定義される。

この関数は、2つの画像のキーポイントのマッチを出力画像に描画する。マッチは2つのキーポイント(円)を結ぶ線である。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