OpenCV 4.11.0
开源计算机视觉库
加载中...
搜索中...
无匹配
关键点和匹配的绘制函数

详细描述

枚举

枚举结构体 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)
 绘制从两幅图像中找到的关键点匹配。
 
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

枚举结构体 cv::DrawMatchesFlags

#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匹配的颜色(线条和连接的特征点)。如果 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 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