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
IInputArrayThe image
keypoints
VectorOfKeyPointThe keypoints to be drawn
outImage
IInputOutputArrayThe image with the keypoints drawn
color
BgrThe color used to draw the keypoints
type
Features2DToolbox.KeypointDrawTypeThe 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
IInputArrayThe model image
modelKeypoints
VectorOfKeyPointThe keypoints in the model image
observedImage
IInputArrayThe observed image
observedKeyPoints
VectorOfKeyPointThe keypoints in the observed image
matches
VectorOfDMatchMatches. Each matches[i] is k or less matches for the same query descriptor.
result
IInputOutputArrayThe image where model and observed image is displayed side by side. Matches are drawn as indicated by the flag
matchColor
MCvScalarThe color for the match correspondence lines
singlePointColor
MCvScalarThe color for highlighting the keypoints
mask
VectorOfByteThe mask for the matches. Use null for all matches.
flags
Features2DToolbox.KeypointDrawTypeThe 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
IInputArrayThe model image
modelKeypoints
VectorOfKeyPointThe keypoints in the model image
observedImage
IInputArrayThe observed image
observedKeyPoints
VectorOfKeyPointThe keypoints in the observed image
matches
VectorOfVectorOfDMatchMatches. Each matches[i] is k or less matches for the same query descriptor.
result
IInputOutputArrayThe image where model and observed image is displayed side by side. Matches are drawn as indicated by the flag
matchColor
MCvScalarThe color for the match correspondence lines
singlePointColor
MCvScalarThe color for highlighting the keypoints
mask
IInputArrayThe mask for the matches. Use null for all matches.
flags
Features2DToolbox.KeypointDrawTypeThe 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
IInputArrayThe model image
modelKeypoints
VectorOfKeyPointThe keypoints in the model image
observedImage
IInputArrayThe observed image
observedKeyPoints
VectorOfKeyPointThe keypoints in the observed image
matches
VectorOfVectorOfDMatchMatches. Each matches[i] is k or less matches for the same query descriptor.
result
IInputOutputArrayThe image where model and observed image is displayed side by side. Matches are drawn as indicated by the flag
matchColor
MCvScalarThe color for the match correspondence lines
singlePointColor
MCvScalarThe color for highlighting the keypoints
mask
VectorOfVectorOfByteThe mask for the matches. Use null for all matches.
flags
Features2DToolbox.KeypointDrawTypeThe 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
VectorOfKeyPointThe model keypoints
observed
VectorOfKeyPointThe observed keypoints
matches
VectorOfVectorOfDMatchMatches. Each matches[i] is k or less matches for the same query descriptor.
mask
MatThe 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
doubleThe 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
VectorOfKeyPointThe keypoints from the model image
observedKeyPoints
VectorOfKeyPointThe keypoints from the observed image
matches
VectorOfVectorOfDMatchMatches. Each matches[i] is k or less matches for the same query descriptor.
mask
MatThis is both input and output. This matrix indicates which row is valid for the matches.
scaleIncrement
doubleThis 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
intThe 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
VectorOfVectorOfDMatchMatches. Each matches[i] is k or less matches for the same query descriptor.
uniquenessThreshold
doubleThe distance different ratio which a match is consider unique, a good number will be 0.8
mask
MatThis is both input and output. This matrix indicates which row is valid for the matches.