OpenCV 4.5.3(日本語機械翻訳)
全て クラス 名前空間 ファイル 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
列挙型 | 関数 | 変数
Features2d_draw

列挙型

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 }

関数

CV_EXPORTS_W void cv::drawKeypoints (InputArray image, const std::vector< KeyPoint > &keypoints, InputOutputArray outImage, const Scalar &color=Scalar::all(-1), DrawMatchesFlags flags=DrawMatchesFlags::DEFAULT)
キーポイントを描画します。[【詳解】(英語]
CV_EXPORTS_W 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つの画像からキーポイントのマッチを見つけて,それを描画します.[【詳解】(英語]
CV_EXPORTS_W 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)
cv::CV_EXPORTS_AS (drawMatchesKnn) void drawMatches(InputArray img1

変数

const std::vector< KeyPoint > & cv::keypoints1
const std::vector< KeyPoint > InputArray cv::img2
const std::vector< KeyPoint > InputArray const std::vector< KeyPoint > & cv::keypoints2
const std::vector< KeyPoint > InputArray const std::vector< KeyPoint > const std::vector< std::vector< DMatch > > & cv::matches1to2
const std::vector< KeyPoint > InputArray const std::vector< KeyPoint > const std::vector< std::vector< DMatch > > InputOutputArray cv::outImg
const std::vector< KeyPoint > InputArray const std::vector< KeyPoint > const std::vector< std::vector< DMatch > > InputOutputArray const Scalar & cv::matchColor =Scalar::all(-1)
const std::vector< KeyPoint > InputArray const std::vector< KeyPoint > const std::vector< std::vector< DMatch > > InputOutputArray const Scalar const Scalar & cv::singlePointColor =Scalar::all(-1)
const std::vector< KeyPoint > InputArray const std::vector< KeyPoint > const std::vector< std::vector< DMatch > > InputOutputArray const Scalar const Scalar const std::vector< std::vector< char > > & cv::matchesMask =std::vector<std::vector<char> >()

詳解

列挙型詳解

DrawMatchesFlags

enum struct cv::DrawMatchesFlags
strong
列挙値
初期設定

出力画像マトリクスが作成される(Mat::create)、つまり、出力画像の既存のメモリを再利用することができます。2つのソース画像、マッチとシングルキーポイントが描かれます。各キーポイントについては,中心点のみが描画されます(キーポイントのサイズと方向を示す,キーポイントを囲む円は描画されません).

draw_over_outimg

出力画像のマトリックスは作成されません (Mat::create). マッチは出力画像の既存のコンテンツに描画されます。

not_draw_single_points

単一のキーポイントは描画されません。

draw_rich_keypoints

各キーポイントに対して、キーポイントを囲む円が、キーポイントの大きさと向きで描画されます。

関数詳解

drawKeypoints()

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

キーポイントを描画します。

引数
image 元画像。
keypoints 元画像のキーポイントを描画します。
outImage 出力画像.その内容は,出力画像に何が描画されるかを定義する flags の値に依存します.以下の 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/2]

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

これはオーバーロードされたメンバ関数です。利便性のために用意されています。元の関数との違いは引き数のみです。

drawMatches() [2/2]

CV_EXPORTS_W 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つの画像からキーポイントのマッチを見つけて,それを描画します.

引数
img1 1つ目の入力画像.
keypoints1 1枚目の画像から得られたキーポイント.
img2 2番目のソース画像.
keypoints2 2枚目の画像からのキーポイント
matches1to2 1つ目の画像から2つ目の画像へのマッチ,つまり,keypoints1[i] が keypoints2[matches[i]] の中に対応する点を持つことを意味します.
outImg 出力画像.その内容は,出力画像に何が描画されるかを定義する flags の値に依存します.以下の flags ビット値を参照してください.
matchColor マッチ(線と接続されたキーポイント)の色.もし matchColor==Scalar::all(-1) の場合,その色はランダムに生成されます.
singlePointColor 単一のキーポイントの色(丸),これはキーポイントがマッチを持たないことを意味します.singlePointColor==の場合Scalar::all(-1) の場合,その色はランダムに生成されます.
matchesMask どのマッチが描画されるかを決定するマスク.マスクが空の場合,すべてのマッチが描画されます.
flags Flags 描画機能を設定します。可能なフラグのビット値は, DrawMatchesFlags によって定義されます.

この関数は,2つの画像のキーポイントのマッチを,出力画像に描画します.マッチとは,2つのキーポイント(円)を結ぶ線のことです.参照cv::DrawMatchesFlags.