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