Ejemplo n.º 1
0
 /// <summary>
 /// Finds the k best matches for each descriptor from a query set.
 /// </summary>
 /// <param name="queryDescriptors">Query set of descriptors.</param>
 /// <param name="trainDescriptors">Train set of descriptors. This set is not added to the train descriptors collection stored in the class object.</param>
 /// <param name="matches">Matches. Each matches[i] is k or less matches for the same query descriptor.</param>
 /// <param name="k">Count of best matches found per each query descriptor or less if a query descriptor has less than k possible matches in total.</param>
 /// <param name="mask">Mask specifying permissible matches between an input query and train matrices of descriptors.</param>
 /// <param name="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.</param>
 public void KnnMatch(
     IInputArray queryDescriptors,
     IInputArray trainDescriptors,
     VectorOfVectorOfDMatch matches,
     int k,
     IInputArray mask   = null,
     bool compactResult = false)
 {
     using (InputArray iaQueryDesccriptor = queryDescriptors.GetInputArray())
         using (InputArray iaTrainDescriptot = trainDescriptors.GetInputArray())
             using (InputArray iaMask = mask == null ? InputArray.GetEmpty() : mask.GetInputArray())
             {
                 Features2DInvoke.cveDescriptorMatcherKnnMatch1(
                     _descriptorMatcherPtr,
                     iaQueryDesccriptor,
                     iaTrainDescriptot,
                     matches,
                     k,
                     iaMask,
                     compactResult);
             }
 }