OpenCV  3.3.1-dev
Open Source Computer Vision
Classes | Functions
Drawing Function of Keypoints and Matches

Classes

struct  cv::DrawMatchesFlags
 

Functions

void cv::drawKeypoints (InputArray image, const std::vector< KeyPoint > &keypoints, InputOutputArray outImage, const Scalar &color=Scalar::all(-1), int flags=DrawMatchesFlags::DEFAULT)
 Draws keypoints. More...
 
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 >(), int flags=DrawMatchesFlags::DEFAULT)
 Draws the found matches of keypoints from two images. More...
 
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 > >(), int flags=DrawMatchesFlags::DEFAULT)
 

Detailed Description

Function Documentation

§ drawKeypoints()

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

Draws keypoints.

Parameters
imageSource image.
keypointsKeypoints from the source image.
outImageOutput image. Its content depends on the flags value defining what is drawn in the output image. See possible flags bit values below.
colorColor of keypoints.
flagsFlags setting drawing features. Possible flags bit values are defined by DrawMatchesFlags. See details above in drawMatches .
Note
For Python API, flags are modified as cv2.DRAW_MATCHES_FLAGS_DEFAULT, cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS, cv2.DRAW_MATCHES_FLAGS_DRAW_OVER_OUTIMG, cv2.DRAW_MATCHES_FLAGS_NOT_DRAW_SINGLE_POINTS

§ drawMatches() [1/2]

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 >(),
int  flags = DrawMatchesFlags::DEFAULT 
)
Python:
outImg=cv.drawMatches(img1, keypoints1, img2, keypoints2, matches1to2, outImg[, matchColor[, singlePointColor[, matchesMask[, flags]]]])
outImg=cv.drawMatchesKnn(img1, keypoints1, img2, keypoints2, matches1to2, outImg[, matchColor[, singlePointColor[, matchesMask[, flags]]]])

Draws the found matches of keypoints from two images.

Parameters
img1First source image.
keypoints1Keypoints from the first source image.
img2Second source image.
keypoints2Keypoints from the second source image.
matches1to2Matches from the first image to the second one, which means that keypoints1[i] has a corresponding point in keypoints2[matches[i]] .
outImgOutput image. Its content depends on the flags value defining what is drawn in the output image. See possible flags bit values below.
matchColorColor of matches (lines and connected keypoints). If matchColor==Scalar::all(-1) , the color is generated randomly.
singlePointColorColor of single keypoints (circles), which means that keypoints do not have the matches. If singlePointColor==Scalar::all(-1) , the color is generated randomly.
matchesMaskMask determining which matches are drawn. If the mask is empty, all matches are drawn.
flagsFlags setting drawing features. Possible flags bit values are defined by DrawMatchesFlags.

This function draws matches of keypoints from two images in the output image. Match is a line connecting two keypoints (circles). See cv::DrawMatchesFlags.

§ drawMatches() [2/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 > >(),
int  flags = DrawMatchesFlags::DEFAULT 
)
Python:
outImg=cv.drawMatches(img1, keypoints1, img2, keypoints2, matches1to2, outImg[, matchColor[, singlePointColor[, matchesMask[, flags]]]])
outImg=cv.drawMatchesKnn(img1, keypoints1, img2, keypoints2, matches1to2, outImg[, matchColor[, singlePointColor[, matchesMask[, flags]]]])

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.