Results of CvKNearest::find_nearest

asked 2014-04-30 01:43:51 -0600

Adi gravatar image

The function CvKNearest::find_nearest(const Mat& samples, int k, Mat& results, Mat& neighborResponses, Mat& dists) returns 3 results:

  1. Mat& results,
  2. Mat& neighborResponses,
  3. Mat& dists

From the docs, I don't understand exactly what results and neighborResponses are.

With k=1, they are identical - the index of the nearest neighbor.
With k>1, results seems to hold the indices of the nearest neighbor, and neighborResponses hold the indices of all k nearest neighbors.

Hence, results is always the first column of neighborResponses.
So why have both as outputs?

edit retag flag offensive close merge delete