Table of Contents

Method FindNearest

Namespace
OpenCvSharp.ML
Assembly
OpenCvSharp.dll

FindNearest(InputArray, int, OutputArray, OutputArray, OutputArray)

Finds the neighbors and predicts responses for input vectors.

public float FindNearest(InputArray samples, int k, OutputArray results, OutputArray neighborResponses = default, OutputArray dist = default)

Parameters

samples InputArray

Input samples stored by rows. It is a single-precision floating-point matrix of [number_of_samples] * k size.

k int

Number of used nearest neighbors. Should be greater than 1.

results OutputArray

Vector with results of prediction (regression or classification) for each input sample. It is a single-precision floating-point vector with [number_of_samples] elements.

neighborResponses OutputArray

neighborResponses Optional output values for corresponding neighbors. It is a single-precision floating-point matrix of [number_of_samples] * k size.

dist OutputArray

Optional output distances from the input vectors to the corresponding neighbors. It is a single-precision floating-point matrix of [number_of_samples] * k size.

Returns

float