Table of Contents

Method KnnSearch

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

KnnSearch(InputArray, OutputArray, OutputArray, int, int)

Performs a K-nearest neighbor search for the given query vector(s) using the index.

public void KnnSearch(InputArray query, OutputArray indices, OutputArray dists, int knn, int searchK = -1)

Parameters

query InputArray

The query vector(s).

indices OutputArray

Output matrix that will contain the indices of the K-nearest neighbors found.

dists OutputArray

Output matrix that will contain the distances to the K-nearest neighbors found.

knn int

Number of nearest neighbors to search for.

searchK int

The maximum number of nodes to inspect; defaults to trees x knn when -1.