Table of Contents

Method DrawMatches

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

DrawMatches(Mat, IEnumerable<KeyPoint>, Mat, IEnumerable<KeyPoint>, IEnumerable<DMatch>, Mat, Scalar?, Scalar?, IEnumerable<byte>?, DrawMatchesFlags)

Draws the found matches of keypoints from two images.

public static void DrawMatches(Mat img1, IEnumerable<KeyPoint> keypoints1, Mat img2, IEnumerable<KeyPoint> keypoints2, IEnumerable<DMatch> matches1To2, Mat outImg, Scalar? matchColor = null, Scalar? singlePointColor = null, IEnumerable<byte>? matchesMask = null, DrawMatchesFlags flags = DrawMatchesFlags.Default)

Parameters

img1 Mat

First source image.

keypoints1 IEnumerable<KeyPoint>

Keypoints from the first source image.

img2 Mat

Second source image.

keypoints2 IEnumerable<KeyPoint>

Keypoints from the second source image.

matches1To2 IEnumerable<DMatch>

Matches from the first image to the second one, which means that keypoints1[i] has a corresponding point in keypoints2[matches[i]] .

outImg Mat

Output image. Its content depends on the flags value defining what is drawn in the output image. See possible flags bit values below.

matchColor Scalar?

Color of matches (lines and connected keypoints). If matchColor==Scalar::all(-1), the color is generated randomly.

singlePointColor Scalar?

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 IEnumerable<byte>

Mask determining which matches are drawn. If the mask is empty, all matches are drawn.

flags DrawMatchesFlags

Flags setting drawing features. Possible flags bit values are defined by DrawMatchesFlags.