/// <summary>
/// Computes an image descriptor using the set visual vocabulary.
/// </summary>
/// <param name="keypointDescriptors">Computed descriptors to match with vocabulary.</param>
/// <param name="imgDescriptor">Computed output image descriptor.</param>
/// <param name="pointIdxsOfClusters">Indices of keypoints that belong to the cluster.
/// This means that pointIdxsOfClusters[i] are keypoint indices that belong to the i -th cluster(word of vocabulary) returned if it is non-zero.</param>
public void Compute(InputArray keypointDescriptors, OutputArray imgDescriptor, out int[][] pointIdxsOfClusters)
{
ThrowIfDisposed();
if (keypointDescriptors == null)
{
throw new ArgumentNullException(nameof(keypointDescriptors));
}
if (imgDescriptor == null)
{
throw new ArgumentNullException(nameof(imgDescriptor));
}
using (var pointIdxsOfClustersVec = new VectorOfVectorInt())
{
NativeMethods.features2d_BOWImgDescriptorExtractor_compute12(
ptr, keypointDescriptors.CvPtr, imgDescriptor.CvPtr, pointIdxsOfClustersVec.CvPtr);
pointIdxsOfClusters = pointIdxsOfClustersVec.ToArray();
}
GC.KeepAlive(keypointDescriptors);
GC.KeepAlive(imgDescriptor);
}