Class cv::cuda::DescriptorMatcher#
Abstract base class for matching keypoint descriptors. View details
#include <opencv2/cudafeatures2d.hpp>Collaboration diagram for cv::cuda::DescriptorMatcher:
Public Member Functions#
Public Member Functions inherited from cv::Algorithm
Return |
Name |
Description |
|---|---|---|
|
Clears the algorithm state. |
|
|
Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read. |
|
|
Reads algorithm parameters from a file storage. |
|
|
||
|
|
|
|
Stores algorithm parameters in a file storage. |
|
|
Static Public Member Functions#
Static Public Member Functions inherited from cv::Algorithm
Return |
Name |
Description |
|---|---|---|
|
|
Loads algorithm from the file. |
|
|
Loads algorithm from a String. |
|
Reads algorithm from the file node. |
Additional Inherited Members#
Protected Member Functions inherited from cv::Algorithm
Return |
Name |
Description |
|---|---|---|
|
Detailed Description#
Abstract base class for matching keypoint descriptors.
It has two groups of match methods: for matching descriptors of an image with another image or with an image set.
Member Function Documentation#
createBFMatcher()#
static Ptr< cuda::DescriptorMatcher > cv::cuda::DescriptorMatcher::createBFMatcher(int normType = cv::NORM_L2)
Brute-force descriptor matcher.
For each descriptor in the first set, this matcher finds the closest descriptor in the second set by trying each one. This descriptor matcher supports masking permissible matches of descriptor sets.
Parameters
add()#
void cv::cuda::DescriptorMatcher::add(const std::vector< GpuMat > & descriptors)
Adds descriptors to train a descriptor collection.
If the collection is not empty, the new descriptors are added to existing train descriptors.
Parameters
descriptors— Descriptors to add. Each descriptors[i] is a set of descriptors from the same train image.
clear()#
void cv::cuda::DescriptorMatcher::clear()
Clears the train descriptor collection.
empty()#
bool cv::cuda::DescriptorMatcher::empty()
Returns true if there are no train descriptors in the collection.
getTrainDescriptors()#
const std::vector< GpuMat > & cv::cuda::DescriptorMatcher::getTrainDescriptors()
Returns a constant link to the train descriptor collection.
isMaskSupported()#
bool cv::cuda::DescriptorMatcher::isMaskSupported()
Returns true if the descriptor matcher supports masking permissible matches.
knnMatch()#
void cv::cuda::DescriptorMatcher::knnMatch(
InputArray queryDescriptors,
InputArray trainDescriptors,
std::vector< std::vector< DMatch > > & matches,
int k,
InputArray mask = noArray(),
bool compactResult = false )
Finds the k best matches for each descriptor from a query set (blocking version).
These extended variants of DescriptorMatcher::match methods find several best matches for each query descriptor. The matches are returned in the distance increasing order. See DescriptorMatcher::match for the details about query and train descriptors.
Parameters
queryDescriptors— Query set of descriptors.trainDescriptors— Train set of descriptors. This set is not added to the train descriptors collection stored in the class object.matches— Matches. Each matches[i] is k or less matches for the same query descriptor.k— Count of best matches found per each query descriptor or less if a query descriptor has less than k possible matches in total.mask— Mask specifying permissible matches between an input query and train matrices of descriptors.compactResult— Parameter 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()#
void cv::cuda::DescriptorMatcher::knnMatch(
InputArray queryDescriptors,
std::vector< std::vector< DMatch > > & matches,
int k,
const std::vector< GpuMat > & masks = std::vector< GpuMat >(),
bool compactResult = false )
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
knnMatchAsync()#
void cv::cuda::DescriptorMatcher::knnMatchAsync(
InputArray queryDescriptors,
InputArray trainDescriptors,
OutputArray matches,
int k,
InputArray mask = noArray(),
Stream & stream = Stream::Null() )
Finds the k best matches for each descriptor from a query set (asynchronous version).
These extended variants of DescriptorMatcher::matchAsync methods find several best matches for each query descriptor. The matches are returned in the distance increasing order. See DescriptorMatcher::matchAsync for the details about query and train descriptors.
Parameters
queryDescriptors— Query set of descriptors.trainDescriptors— Train set of descriptors. This set is not added to the train descriptors collection stored in the class object.matches— Matches array stored in GPU memory. Internal representation is not defined. Use DescriptorMatcher::knnMatchConvert method to retrieve results in standard representation.k— Count of best matches found per each query descriptor or less if a query descriptor has less than k possible matches in total.mask— Mask specifying permissible matches between an input query and train matrices of descriptors.stream— CUDA stream.
knnMatchAsync()#
void cv::cuda::DescriptorMatcher::knnMatchAsync(
InputArray queryDescriptors,
OutputArray matches,
int k,
const std::vector< GpuMat > & masks = std::vector< GpuMat >(),
Stream & stream = Stream::Null() )
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
knnMatchConvert()#
void cv::cuda::DescriptorMatcher::knnMatchConvert(
InputArray gpu_matches,
std::vector< std::vector< DMatch > > & matches,
bool compactResult = false )
Converts matches array from internal representation to standard matches vector.
The method is supposed to be used with DescriptorMatcher::knnMatchAsync to get final result. Call this method only after DescriptorMatcher::knnMatchAsync is completed (ie. after synchronization).
Parameters
gpu_matches— Matches, returned from DescriptorMatcher::knnMatchAsync.matches— Vector of DMatch objects.compactResult— Parameter 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()#
void cv::cuda::DescriptorMatcher::match(
InputArray queryDescriptors,
InputArray trainDescriptors,
std::vector< DMatch > & matches,
InputArray mask = noArray() )
Finds the best match for each descriptor from a query set (blocking version).
In the first variant of this method, the train descriptors are passed as an input argument. In the second variant of the method, train descriptors collection that was set by DescriptorMatcher::add is used. Optional mask (or masks) can be passed to specify which query and training descriptors can be matched. Namely, queryDescriptors[i] can be matched with trainDescriptors[j] only if mask.at
Parameters
queryDescriptors— Query set of descriptors.trainDescriptors— Train set of descriptors. This set is not added to the train descriptors collection stored in the class object.matches— Matches. 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— Mask specifying permissible matches between an input query and train matrices of descriptors.
match()#
void cv::cuda::DescriptorMatcher::match(
InputArray queryDescriptors,
std::vector< DMatch > & matches,
const std::vector< GpuMat > & masks = std::vector< GpuMat >() )
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
matchAsync()#
void cv::cuda::DescriptorMatcher::matchAsync(
InputArray queryDescriptors,
InputArray trainDescriptors,
OutputArray matches,
InputArray mask = noArray(),
Stream & stream = Stream::Null() )
Finds the best match for each descriptor from a query set (asynchronous version).
In the first variant of this method, the train descriptors are passed as an input argument. In the second variant of the method, train descriptors collection that was set by DescriptorMatcher::add is used. Optional mask (or masks) can be passed to specify which query and training descriptors can be matched. Namely, queryDescriptors[i] can be matched with trainDescriptors[j] only if mask.at
Parameters
queryDescriptors— Query set of descriptors.trainDescriptors— Train set of descriptors. This set is not added to the train descriptors collection stored in the class object.matches— Matches array stored in GPU memory. Internal representation is not defined. Use DescriptorMatcher::matchConvert method to retrieve results in standard representation.mask— Mask specifying permissible matches between an input query and train matrices of descriptors.stream— CUDA stream.
matchAsync()#
void cv::cuda::DescriptorMatcher::matchAsync(
InputArray queryDescriptors,
OutputArray matches,
const std::vector< GpuMat > & masks = std::vector< GpuMat >(),
Stream & stream = Stream::Null() )
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
matchConvert()#
void cv::cuda::DescriptorMatcher::matchConvert(
InputArray gpu_matches,
std::vector< DMatch > & matches )
Converts matches array from internal representation to standard matches vector.
The method is supposed to be used with DescriptorMatcher::matchAsync to get final result. Call this method only after DescriptorMatcher::matchAsync is completed (ie. after synchronization).
Parameters
gpu_matches— Matches, returned from DescriptorMatcher::matchAsync.matches— Vector of DMatch objects.
radiusMatch()#
void cv::cuda::DescriptorMatcher::radiusMatch(
InputArray queryDescriptors,
InputArray trainDescriptors,
std::vector< std::vector< DMatch > > & matches,
float maxDistance,
InputArray mask = noArray(),
bool compactResult = false )
For each query descriptor, finds the training descriptors not farther than the specified distance (blocking version).
For each query descriptor, the methods find such training descriptors that the distance between the query descriptor and the training descriptor is equal or smaller than maxDistance. Found matches are returned in the distance increasing order.
Parameters
queryDescriptors— Query set of descriptors.trainDescriptors— Train set of descriptors. This set is not added to the train descriptors collection stored in the class object.matches— Found matches.maxDistance— Threshold 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— Mask specifying permissible matches between an input query and train matrices of descriptors.compactResult— Parameter 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()#
void cv::cuda::DescriptorMatcher::radiusMatch(
InputArray queryDescriptors,
std::vector< std::vector< DMatch > > & matches,
float maxDistance,
const std::vector< GpuMat > & masks = std::vector< GpuMat >(),
bool compactResult = false )
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
radiusMatchAsync()#
void cv::cuda::DescriptorMatcher::radiusMatchAsync(
InputArray queryDescriptors,
InputArray trainDescriptors,
OutputArray matches,
float maxDistance,
InputArray mask = noArray(),
Stream & stream = Stream::Null() )
For each query descriptor, finds the training descriptors not farther than the specified distance (asynchronous version).
For each query descriptor, the methods find such training descriptors that the distance between the query descriptor and the training descriptor is equal or smaller than maxDistance. Found matches are returned in the distance increasing order.
Parameters
queryDescriptors— Query set of descriptors.trainDescriptors— Train set of descriptors. This set is not added to the train descriptors collection stored in the class object.matches— Matches array stored in GPU memory. Internal representation is not defined. Use DescriptorMatcher::radiusMatchConvert method to retrieve results in standard representation.maxDistance— Threshold 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— Mask specifying permissible matches between an input query and train matrices of descriptors.stream— CUDA stream.
radiusMatchAsync()#
void cv::cuda::DescriptorMatcher::radiusMatchAsync(
InputArray queryDescriptors,
OutputArray matches,
float maxDistance,
const std::vector< GpuMat > & masks = std::vector< GpuMat >(),
Stream & stream = Stream::Null() )
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
radiusMatchConvert()#
void cv::cuda::DescriptorMatcher::radiusMatchConvert(
InputArray gpu_matches,
std::vector< std::vector< DMatch > > & matches,
bool compactResult = false )
Converts matches array from internal representation to standard matches vector.
The method is supposed to be used with DescriptorMatcher::radiusMatchAsync to get final result. Call this method only after DescriptorMatcher::radiusMatchAsync is completed (ie. after synchronization).
Parameters
gpu_matches— Matches, returned from DescriptorMatcher::radiusMatchAsync.matches— Vector of DMatch objects.compactResult— Parameter 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()#
void cv::cuda::DescriptorMatcher::train()
Trains a descriptor matcher.
Trains a descriptor matcher (for example, the flann index). In all methods to match, the method train() is run every time before matching.
Source file#
The documentation for this class was generated from the following file:
opencv2/cudafeatures2d.hpp