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