| OpenCV 5.0.0alpha Open Source Computer Vision

Loading...
Searching...
No Matches
Enumerations | Functions
Drawing Function of Keypoints and Matches
Features Framework

## Detailed Description

## Enumerations
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 }

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

Enumerator
DEFAULT | Output image matrix will be created (Mat::create), i.e. existing memory of output image may be reused. Two source image, matches and single keypoints will be drawn. For each keypoint only the center point will be drawn (without the circle around keypoint with keypoint size and orientation).
DRAW_OVER_OUTIMG | Output image matrix will not be created (Mat::create). Matches will be drawn on existing content of output image.
NOT_DRAW_SINGLE_POINTS | Single keypoints will not be drawn.
DRAW_RICH_KEYPOINTS | For each keypoint the circle around keypoint with keypoint size and orientation will be drawn.

## Function Documentation

## ◆ 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/features.hpp>`

Draws keypoints.

Parameters

  image | Source image.
  keypoints | Keypoints from the source image.
  outImage | Output image. Its content depends on the flags value defining what is drawn in the output image. See possible flags bit values below.
  color | Color of keypoints.
  flags | Flags setting drawing features. Possible flags bit values are defined by DrawMatchesFlags. See details above in drawMatches .

Note
  For Python API, flags are modified as 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/features.hpp>`

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

## ◆ 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/features.hpp>`

Draws the found matches of keypoints from two images.

Parameters

  img1 | First source image.
  keypoints1 | Keypoints from the first source image.
  img2 | Second source image.
  keypoints2 | Keypoints from the second source image.
  matches1to2 | Matches from the first image to the second one, which means that keypoints1[i] has a corresponding point in keypoints2[matches[i]] .
  outImg | Output image. Its content depends on the flags value defining what is drawn in the output image. See possible flags bit values below.
  matchColor | Color of matches (lines and connected keypoints). If matchColor==Scalar::all(-1) , the color is generated randomly.
  singlePointColor | Color of single keypoints (circles), which means that keypoints do not have the matches. If singlePointColor==Scalar::all(-1) , the color is generated randomly.
  matchesMask | Mask determining which matches are drawn. If the mask is empty, all matches are drawn.
  flags | Flags 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() [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

`#include <opencv2/features.hpp>`