CvKNearestTrain Method (Mat, Mat, Mat, Boolean, Int32, Boolean) OpenCvSharp Class Library
Trains the model

Namespace:  OpenCvSharp.CPlusPlus
Assembly:  OpenCvSharp.CPlusPlus (in OpenCvSharp.CPlusPlus.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax

public virtual bool Train(
	Mat trainData,
	Mat responses,
	Mat sampleIdx = null,
	bool isRegression = false,
	int maxK = 32,
	bool updateBase = false
)

Parameters

trainData
Type: OpenCvSharp.CPlusPlusMat
Known samples (m*n)
responses
Type: OpenCvSharp.CPlusPlusMat
Classes for known samples (m*1)
sampleIdx (Optional)
Type: OpenCvSharp.CPlusPlusMat

[Missing <param name="sampleIdx"/> documentation for "M:OpenCvSharp.CPlusPlus.CvKNearest.Train(OpenCvSharp.CPlusPlus.Mat,OpenCvSharp.CPlusPlus.Mat,OpenCvSharp.CPlusPlus.Mat,System.Boolean,System.Int32,System.Boolean)"]

isRegression (Optional)
Type: SystemBoolean

[Missing <param name="isRegression"/> documentation for "M:OpenCvSharp.CPlusPlus.CvKNearest.Train(OpenCvSharp.CPlusPlus.Mat,OpenCvSharp.CPlusPlus.Mat,OpenCvSharp.CPlusPlus.Mat,System.Boolean,System.Int32,System.Boolean)"]

maxK (Optional)
Type: SystemInt32
Maximum number of neighbors to return
updateBase (Optional)
Type: SystemBoolean
Adds known samples to model(true) or makes a new one(false)

Return Value

Type: Boolean

[Missing <returns> documentation for "M:OpenCvSharp.CPlusPlus.CvKNearest.Train(OpenCvSharp.CPlusPlus.Mat,OpenCvSharp.CPlusPlus.Mat,OpenCvSharp.CPlusPlus.Mat,System.Boolean,System.Int32,System.Boolean)"]

See Also

Reference