http://www.emgu.com
For each input vector (which are rows of the matrix samples) the method finds k <= get_max_k() nearest neighbor. In case of regression, the predicted result will be a mean value of the particular vector's neighbor responses. In case of classification the class is determined by voting.

Namespace: Emgu.CV.ML
Assembly: Emgu.CV.ML (in Emgu.CV.ML.dll) Version: 2.4.10.1935 (2.4.10.1935)

Syntax

C#
public float FindNearest(
	Matrix<float> samples,
	int k,
	Matrix<float> results,
	Matrix<float> kNearestNeighbors,
	Matrix<float> neighborResponses,
	Matrix<float> dist
)
Visual Basic
Public Function FindNearest ( 
	samples As Matrix(Of Single),
	k As Integer,
	results As Matrix(Of Single),
	kNearestNeighbors As Matrix(Of Single),
	neighborResponses As Matrix(Of Single),
	dist As Matrix(Of Single)
) As Single
Visual C++
public:
float FindNearest(
	Matrix<float>^ samples, 
	int k, 
	Matrix<float>^ results, 
	Matrix<float>^ kNearestNeighbors, 
	Matrix<float>^ neighborResponses, 
	Matrix<float>^ dist
)
F#
member FindNearest : 
        samples : Matrix<float32> * 
        k : int * 
        results : Matrix<float32> * 
        kNearestNeighbors : Matrix<float32> * 
        neighborResponses : Matrix<float32> * 
        dist : Matrix<float32> -> float32 

Parameters

samples
Type: Emgu.CV..::..Matrix<(Of <(<'Single>)>)>
The sample matrix where each row is a sample
k
Type: System..::..Int32
The number of nearest neighbor to find
results
Type: Emgu.CV..::..Matrix<(Of <(<'Single>)>)>
Can be null if not needed. If regression, return a mean value of the particular vector's neighbor responses; If classification, return the class determined by voting.
kNearestNeighbors
Type: Emgu.CV..::..Matrix<(Of <(<'Single>)>)>
Should be null if not needed. Setting it to non-null values incures a performance panalty. A matrix of (k * samples.Rows) rows and (samples.Cols) columns that will be filled the data of the K nearest-neighbor for each sample
neighborResponses
Type: Emgu.CV..::..Matrix<(Of <(<'Single>)>)>
Should be null if not needed. The response of the neighbors. A vector of k*_samples->rows elements.
dist
Type: Emgu.CV..::..Matrix<(Of <(<'Single>)>)>
Should be null if not needed. The distances from the input vectors to the neighbors. A vector of k*_samples->rows elements.

Return Value

Type: Single
In case of regression, the predicted result will be a mean value of the particular vector's neighbor responses. In case of classification the class is determined by voting

See Also