Table of Contents

Class Features2DToolbox

Namespace
Emgu.CV.Features2D
Assembly
Emgu.CV.dll

Tools for features 2D

public static class Features2DToolbox
Inheritance
Features2DToolbox
Inherited Members

Methods

DrawKeypoints(IInputArray, VectorOfKeyPoint, IInputOutputArray, Bgr, KeypointDrawType)

Draw the keypoints found on the image.

public static void DrawKeypoints(IInputArray image, VectorOfKeyPoint keypoints, IInputOutputArray outImage, Bgr color, Features2DToolbox.KeypointDrawType type = KeypointDrawType.Default)

Parameters

image IInputArray

The image

keypoints VectorOfKeyPoint

The keypoints to be drawn

outImage IInputOutputArray

The image with the keypoints drawn

color Bgr

The color used to draw the keypoints

type Features2DToolbox.KeypointDrawType

The drawing type

DrawMatches(IInputArray, VectorOfKeyPoint, IInputArray, VectorOfKeyPoint, VectorOfDMatch, IInputOutputArray, MCvScalar, MCvScalar, VectorOfByte, KeypointDrawType)

Draw the matched keypoints between the model image and the observered image.

public static void DrawMatches(IInputArray modelImage, VectorOfKeyPoint modelKeypoints, IInputArray observedImage, VectorOfKeyPoint observedKeyPoints, VectorOfDMatch matches, IInputOutputArray result, MCvScalar matchColor, MCvScalar singlePointColor, VectorOfByte mask = null, Features2DToolbox.KeypointDrawType flags = KeypointDrawType.Default)

Parameters

modelImage IInputArray

The model image

modelKeypoints VectorOfKeyPoint

The keypoints in the model image

observedImage IInputArray

The observed image

observedKeyPoints VectorOfKeyPoint

The keypoints in the observed image

matches VectorOfDMatch

Matches. Each matches[i] is k or less matches for the same query descriptor.

result IInputOutputArray

The image where model and observed image is displayed side by side. Matches are drawn as indicated by the flag

matchColor MCvScalar

The color for the match correspondence lines

singlePointColor MCvScalar

The color for highlighting the keypoints

mask VectorOfByte

The mask for the matches. Use null for all matches.

flags Features2DToolbox.KeypointDrawType

The drawing type

DrawMatches(IInputArray, VectorOfKeyPoint, IInputArray, VectorOfKeyPoint, VectorOfVectorOfDMatch, IInputOutputArray, MCvScalar, MCvScalar, IInputArray, KeypointDrawType)

Draw the matched keypoints between the model image and the observed image.

public static void DrawMatches(IInputArray modelImage, VectorOfKeyPoint modelKeypoints, IInputArray observedImage, VectorOfKeyPoint observedKeyPoints, VectorOfVectorOfDMatch matches, IInputOutputArray result, MCvScalar matchColor, MCvScalar singlePointColor, IInputArray mask = null, Features2DToolbox.KeypointDrawType flags = KeypointDrawType.Default)

Parameters

modelImage IInputArray

The model image

modelKeypoints VectorOfKeyPoint

The keypoints in the model image

observedImage IInputArray

The observed image

observedKeyPoints VectorOfKeyPoint

The keypoints in the observed image

matches VectorOfVectorOfDMatch

Matches. Each matches[i] is k or less matches for the same query descriptor.

result IInputOutputArray

The image where model and observed image is displayed side by side. Matches are drawn as indicated by the flag

matchColor MCvScalar

The color for the match correspondence lines

singlePointColor MCvScalar

The color for highlighting the keypoints

mask IInputArray

The mask for the matches. Use null for all matches.

flags Features2DToolbox.KeypointDrawType

The drawing type

DrawMatches(IInputArray, VectorOfKeyPoint, IInputArray, VectorOfKeyPoint, VectorOfVectorOfDMatch, IInputOutputArray, MCvScalar, MCvScalar, VectorOfVectorOfByte, KeypointDrawType)

Draw the matched keypoints between the model image and the observed image.

public static void DrawMatches(IInputArray modelImage, VectorOfKeyPoint modelKeypoints, IInputArray observedImage, VectorOfKeyPoint observedKeyPoints, VectorOfVectorOfDMatch matches, IInputOutputArray result, MCvScalar matchColor, MCvScalar singlePointColor, VectorOfVectorOfByte mask = null, Features2DToolbox.KeypointDrawType flags = KeypointDrawType.Default)

Parameters

modelImage IInputArray

The model image

modelKeypoints VectorOfKeyPoint

The keypoints in the model image

observedImage IInputArray

The observed image

observedKeyPoints VectorOfKeyPoint

The keypoints in the observed image

matches VectorOfVectorOfDMatch

Matches. Each matches[i] is k or less matches for the same query descriptor.

result IInputOutputArray

The image where model and observed image is displayed side by side. Matches are drawn as indicated by the flag

matchColor MCvScalar

The color for the match correspondence lines

singlePointColor MCvScalar

The color for highlighting the keypoints

mask VectorOfVectorOfByte

The mask for the matches. Use null for all matches.

flags Features2DToolbox.KeypointDrawType

The drawing type

GetHomographyMatrixFromMatchedFeatures(VectorOfKeyPoint, VectorOfKeyPoint, VectorOfVectorOfDMatch, Mat, double)

Recover the homography matrix using RANDSAC. If the matrix cannot be recovered, null is returned.

public static Mat GetHomographyMatrixFromMatchedFeatures(VectorOfKeyPoint model, VectorOfKeyPoint observed, VectorOfVectorOfDMatch matches, Mat mask, double ransacReprojThreshold)

Parameters

model VectorOfKeyPoint

The model keypoints

observed VectorOfKeyPoint

The observed keypoints

matches VectorOfVectorOfDMatch

Matches. Each matches[i] is k or less matches for the same query descriptor.

mask Mat

The mask matrix of which the value might be modified by the function. As input, if the value is 0, the corresponding match will be ignored when computing the homography matrix. If the value is 1 and RANSAC determine the match is an outlier, the value will be set to 0.

ransacReprojThreshold double

The maximum allowed reprojection error to treat a point pair as an inlier. If srcPoints and dstPoints are measured in pixels, it usually makes sense to set this parameter somewhere in the range 1 to 10.

Returns

Mat

The homography matrix, if it cannot be found, null is returned

VoteForSizeAndOrientation(VectorOfKeyPoint, VectorOfKeyPoint, VectorOfVectorOfDMatch, Mat, double, int)

Eliminate the matched features whose scale and rotation do not aggree with the majority's scale and rotation.

public static int VoteForSizeAndOrientation(VectorOfKeyPoint modelKeyPoints, VectorOfKeyPoint observedKeyPoints, VectorOfVectorOfDMatch matches, Mat mask, double scaleIncrement, int rotationBins)

Parameters

modelKeyPoints VectorOfKeyPoint

The keypoints from the model image

observedKeyPoints VectorOfKeyPoint

The keypoints from the observed image

matches VectorOfVectorOfDMatch

Matches. Each matches[i] is k or less matches for the same query descriptor.

mask Mat

This is both input and output. This matrix indicates which row is valid for the matches.

scaleIncrement double

This determines the different in scale for neighbor hood bins, a good value might be 1.5 (which means matched features in bin i+1 is scaled 1.5 times larger than matched features in bin i

rotationBins int

The numbers of bins for rotation, a good value might be 20 (which means each bin covers 18 degree)

Returns

int

The number of non-zero elements in the resulting mask

VoteForUniqueness(VectorOfVectorOfDMatch, double, Mat)

Filter the matched Features, such that if a match is not unique, it is rejected.

public static void VoteForUniqueness(VectorOfVectorOfDMatch matches, double uniquenessThreshold, Mat mask)

Parameters

matches VectorOfVectorOfDMatch

Matches. Each matches[i] is k or less matches for the same query descriptor.

uniquenessThreshold double

The distance different ratio which a match is consider unique, a good number will be 0.8

mask Mat

This is both input and output. This matrix indicates which row is valid for the matches.