For every input query descriptor, retrieve the best k matching ones from a dataset provided from user or from the one internal to class
matches = matcher.knnMatch(queryDescriptors, trainDescriptors, k)
matches = matcher.knnMatch(queryDescriptors, k)
[...] = matcher.knnMatch(..., 'OptionName', optionValue, ...)
Input
- queryDescriptors query descriptors.
- trainDescriptors dataset of descriptors furnished by user.
- k number of the closest descriptors to be returned for
every input query.
Output
- matches vector to host retrieved matches.
Options
- Mask mask to select which input descriptors must be
matched to ones in dataset. A vector of masks in the second
variant (the i-th mask in vector indicates whether each input
query can be matched with descriptors in dataset relative to
i-th image). Not set by default.
- CompactResult flag to obtain a compact result (if true, a
vector that doesn't contain any matches for a given query is
not inserted in final result). default false
For every input descriptor, find the best k matching descriptors:
- in the first variant, for a pair of images
- in the second variant, from one image to a set