Class DescriptorMatcher
Descriptor matcher
public abstract class DescriptorMatcher : SharedPtrObject, IDisposable, IAlgorithm
- Inheritance
-
DescriptorMatcher
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
DescriptorMatcher()
protected DescriptorMatcher()
Fields
_algorithmPtr
Pointer to the native cv::Algorithm
protected nint _algorithmPtr
Field Value
Properties
Empty
Return True if the matcher is empty
public bool Empty { get; }
Property Value
IsMaskSupported
Return True if mask is supported
public bool IsMaskSupported { get; }
Property Value
Methods
Add(IInputArray)
Add the model descriptors
public void Add(IInputArray modelDescriptors)
Parameters
modelDescriptors
IInputArrayThe model descriptors
Clear()
Clear the matcher
public void Clear()
DisposeObject()
Release all the unmanaged memory associated with this matcher
protected override void DisposeObject()
KnnMatch(IInputArray, IInputArray, VectorOfVectorOfDMatch, int, IInputArray, bool)
Find the k-nearest match
public void KnnMatch(IInputArray queryDescriptors, IInputArray trainDescriptors, VectorOfVectorOfDMatch matches, int k, IInputArray mask = null, bool compactResult = false)
Parameters
queryDescriptors
IInputArrayAn n x m matrix of descriptors to be query for nearest neighbors. n is the number of descriptor and m is the size of the descriptor
trainDescriptors
IInputArrayTrain set of descriptors. This set is not added to the train descriptors collection stored in the class object.
matches
VectorOfVectorOfDMatchMatches. Each matches[i] is k or less matches for the same query descriptor.
k
intNumber of nearest neighbors to search for
mask
IInputArrayCan be null if not needed. An n x 1 matrix. If 0, the query descriptor in the corresponding row will be ignored.
compactResult
boolParameter used when the mask (or masks) is not empty. If compactResult is false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, the matches vector does not contain matches for fully masked-out query descriptors.
KnnMatch(IInputArray, VectorOfVectorOfDMatch, int, VectorOfGpuMat, bool)
Find the k-nearest match
public void KnnMatch(IInputArray queryDescriptors, VectorOfVectorOfDMatch matches, int k, VectorOfGpuMat masks = null, bool compactResult = false)
Parameters
queryDescriptors
IInputArrayAn n x m matrix of descriptors to be query for nearest neighbors. n is the number of descriptor and m is the size of the descriptor
matches
VectorOfVectorOfDMatchMatches. Each matches[i] is k or less matches for the same query descriptor.
k
intNumber of nearest neighbors to search for
masks
VectorOfGpuMatCan be null if not needed. An n x 1 matrix. If 0, the query descriptor in the corresponding row will be ignored.
compactResult
boolParameter used when the mask (or masks) is not empty. If compactResult is false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, the matches vector does not contain matches for fully masked-out query descriptors.
KnnMatchAsync(IInputArray, IInputArray, IOutputArray, int, IInputArray, Stream)
Finds the k best matches for each descriptor from a query set (asynchronous version).
public void KnnMatchAsync(IInputArray queryDescriptors, IInputArray trainDescriptors, IOutputArray matches, int k, IInputArray mask = null, Stream stream = null)
Parameters
queryDescriptors
IInputArrayQuery set of descriptors.
trainDescriptors
IInputArrayTrain set of descriptors. This set is not added to the train descriptors collection stored in the class object.
matches
IOutputArrayMatches array stored in GPU memory. Internal representation is not defined. Use DescriptorMatcher::knnMatchConvert method to retrieve results in standard representation.
k
intCount of best matches found per each query descriptor or less if a query descriptor has less than k possible matches in total.
mask
IInputArrayMask specifying permissible matches between an input query and train matrices of descriptors.
stream
StreamCUDA stream.
KnnMatchAsync(IInputArray, IOutputArray, int, VectorOfGpuMat, Stream)
Finds the k best matches for each descriptor from a query set (asynchronous version).
public void KnnMatchAsync(IInputArray queryDescriptors, IOutputArray matches, int k, VectorOfGpuMat masks = null, Stream stream = null)
Parameters
queryDescriptors
IInputArrayQuery set of descriptors.
matches
IOutputArrayMatches array stored in GPU memory. Internal representation is not defined. Use DescriptorMatcher::knnMatchConvert method to retrieve results in standard representation.
k
intCount of best matches found per each query descriptor or less if a query descriptor has less than k possible matches in total.
masks
VectorOfGpuMatMask specifying permissible matches between an input query and train matrices of descriptors.
stream
StreamCUDA stream.
KnnMatchConvert(IInputArray, VectorOfVectorOfDMatch, bool)
Converts matches array from internal representation to standard matches vector.
public void KnnMatchConvert(IInputArray gpuMatches, VectorOfVectorOfDMatch matches, bool compactResult = false)
Parameters
gpuMatches
IInputArrayMatches
matches
VectorOfVectorOfDMatchVector of DMatch objects.
compactResult
boolParameter used when the mask (or masks) is not empty. If compactResult is false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, the matches vector does not contain matches for fully masked-out query descriptors.
Match(IInputArray, IInputArray, VectorOfDMatch, IInputArray)
Finds the best match for each descriptor from a query set (blocking version).
public void Match(IInputArray queryDescriptors, IInputArray trainDescriptors, VectorOfDMatch matches, IInputArray mask = null)
Parameters
queryDescriptors
IInputArrayQuery set of descriptors.
trainDescriptors
IInputArrayTrain set of descriptors. This set is not added to the train descriptors collection stored in the class object.
matches
VectorOfDMatchMatches. If a query descriptor is masked out in mask , no match is added for this descriptor. So, matches size may be smaller than the query descriptors count.
mask
IInputArrayMask specifying permissible matches between an input query and train matrices of descriptors.
Match(IInputArray, VectorOfDMatch, VectorOfGpuMat)
Finds the best match for each descriptor from a query set (blocking version).
public void Match(IInputArray queryDescriptors, VectorOfDMatch matches, VectorOfGpuMat mask = null)
Parameters
queryDescriptors
IInputArrayQuery set of descriptors.
matches
VectorOfDMatchMatches. If a query descriptor is masked out in mask , no match is added for this descriptor. So, matches size may be smaller than the query descriptors count.
mask
VectorOfGpuMatMask specifying permissible matches between an input query and train matrices of descriptors.
MatchAsync(IInputArray, IInputArray, IOutputArray, IInputArray, Stream)
Finds the best match for each descriptor from a query set (asynchronous version).
public void MatchAsync(IInputArray queryDescriptors, IInputArray trainDescriptors, IOutputArray matches, IInputArray mask = null, Stream stream = null)
Parameters
queryDescriptors
IInputArrayQuery set of descriptors.
trainDescriptors
IInputArrayTrain set of descriptors. This set is not added to the train descriptors collection stored in the class object.
matches
IOutputArrayMatches array stored in GPU memory. Internal representation is not defined. Use DescriptorMatcher::matchConvert method to retrieve results in standard representation.
mask
IInputArrayMask specifying permissible matches between an input query and train matrices of descriptors.
stream
StreamCUDA stream.
MatchAsync(IInputArray, IOutputArray, VectorOfGpuMat, Stream)
Finds the best match for each descriptor from a query set (asynchronous version).
public void MatchAsync(IInputArray queryDescriptors, IOutputArray matches, VectorOfGpuMat masks = null, Stream stream = null)
Parameters
queryDescriptors
IInputArrayQuery set of descriptors.
matches
IOutputArrayMatches array stored in GPU memory. Internal representation is not defined. Use DescriptorMatcher::matchConvert method to retrieve results in standard representation.
masks
VectorOfGpuMatMask specifying permissible matches between an input query and train matrices of descriptors.
stream
StreamCUDA stream.
MatchConvert(IInputArray, VectorOfDMatch)
Converts matches array from internal representation to standard matches vector.
public void MatchConvert(IInputArray gpuMatches, VectorOfDMatch matches)
Parameters
gpuMatches
IInputArrayMatches, returned from MatchAsync.
matches
VectorOfDMatchVector of DMatch objects.
RadiusMatch(IInputArray, IInputArray, VectorOfVectorOfDMatch, float, IInputArray, bool)
For each query descriptor, finds the training descriptors not farther than the specified distance (blocking version).
public void RadiusMatch(IInputArray queryDescriptors, IInputArray trainDescriptors, VectorOfVectorOfDMatch matches, float maxDistance, IInputArray mask = null, bool compactResult = false)
Parameters
queryDescriptors
IInputArrayQuery set of descriptors.
trainDescriptors
IInputArrayTrain set of descriptors. This set is not added to the train descriptors collection stored in the class object.
matches
VectorOfVectorOfDMatchFound matches.
maxDistance
floatThreshold for the distance between matched descriptors. Distance means here metric distance (e.g. Hamming distance), not the distance between coordinates (which is measured in Pixels)!
mask
IInputArrayMask specifying permissible matches between an input query and train matrices of descriptors.
compactResult
boolParameter used when the mask (or masks) is not empty. If compactResult is false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, the matches vector does not contain matches for fully masked-out query descriptors.
RadiusMatch(IInputArray, VectorOfVectorOfDMatch, float, VectorOfGpuMat, bool)
For each query descriptor, finds the training descriptors not farther than the specified distance (blocking version).
public void RadiusMatch(IInputArray queryDescriptors, VectorOfVectorOfDMatch matches, float maxDistance, VectorOfGpuMat masks = null, bool compactResult = false)
Parameters
queryDescriptors
IInputArrayQuery set of descriptors.
matches
VectorOfVectorOfDMatchFound matches.
maxDistance
floatThreshold for the distance between matched descriptors. Distance means here metric distance (e.g. Hamming distance), not the distance between coordinates (which is measured in Pixels)!
masks
VectorOfGpuMatMask specifying permissible matches between an input query and train matrices of descriptors.
compactResult
boolParameter used when the mask (or masks) is not empty. If compactResult is false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, the matches vector does not contain matches for fully masked-out query descriptors.
RadiusMatchAsync(IInputArray, IInputArray, IOutputArray, float, IInputArray, Stream)
For each query descriptor, finds the training descriptors not farther than the specified distance (asynchronous version).
public void RadiusMatchAsync(IInputArray queryDescriptors, IInputArray trainDescriptors, IOutputArray matches, float maxDistance, IInputArray mask = null, Stream stream = null)
Parameters
queryDescriptors
IInputArrayQuery set of descriptors.
trainDescriptors
IInputArrayTrain set of descriptors. This set is not added to the train descriptors collection stored in the class object.
matches
IOutputArrayMatches array stored in GPU memory. Internal representation is not defined.
maxDistance
floatThreshold for the distance between matched descriptors. Distance means here metric distance (e.g. Hamming distance), not the distance between coordinates (which is measured in Pixels)!
mask
IInputArrayMask specifying permissible matches between an input query and train matrices of descriptors.
stream
StreamCUDA stream.
RadiusMatchAsync(IInputArray, IOutputArray, float, VectorOfGpuMat, Stream)
For each query descriptor, finds the training descriptors not farther than the specified distance (asynchronous version).
public void RadiusMatchAsync(IInputArray queryDescriptors, IOutputArray matches, float maxDistance, VectorOfGpuMat masks, Stream stream)
Parameters
queryDescriptors
IInputArrayQuery set of descriptors.
matches
IOutputArrayMatches array stored in GPU memory. Internal representation is not defined.
maxDistance
floatThreshold for the distance between matched descriptors. Distance means here metric distance (e.g. Hamming distance), not the distance between coordinates (which is measured in Pixels)!
masks
VectorOfGpuMatMask specifying permissible matches between an input query and train matrices of descriptors.
stream
StreamCUDA stream.
RadiusMatchConvert(IInputArray, VectorOfVectorOfDMatch, bool)
Converts matches array from internal representation to standard matches vector.
public void RadiusMatchConvert(IInputArray gpuMatches, VectorOfVectorOfDMatch matches, bool compactResult)
Parameters
gpuMatches
IInputArrayMatches, returned from DescriptorMatcher.RadiusMatchAsync.
matches
VectorOfVectorOfDMatchVector of DMatch objects.
compactResult
boolParameter used when the mask (or masks) is not empty. If compactResult is false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, the matches vector does not contain matches for fully masked-out query descriptors.
Train()
Trains a descriptor matcher.
public void Train()