OpenCV for Unity 2.6.4
Enox Software / Please refer to OpenCV official document ( http://docs.opencv.org/4.10.0/index.html ) for the details of the argument of the method.
|
Base class for statistical models in OpenCV ML. More...
Public Member Functions | |
float | calcError (TrainData data, bool test, Mat resp) |
Computes error on the training or test dataset. | |
override bool | empty () |
Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read. | |
int | getVarCount () |
Returns the number of variables in training samples. | |
bool | isClassifier () |
Returns true if the model is classifier. | |
bool | isTrained () |
Returns true if the model is trained. | |
virtual float | predict (Mat samples) |
Predicts response(s) for the provided sample(s) | |
virtual float | predict (Mat samples, Mat results) |
Predicts response(s) for the provided sample(s) | |
virtual float | predict (Mat samples, Mat results, int flags) |
Predicts response(s) for the provided sample(s) | |
bool | train (Mat samples, int layout, Mat responses) |
Trains the statistical model. | |
bool | train (TrainData trainData) |
Trains the statistical model. | |
bool | train (TrainData trainData, int flags) |
Trains the statistical model. | |
Public Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm | |
virtual void | clear () |
Clears the algorithm state. | |
virtual string | getDefaultName () |
IntPtr | getNativeObjAddr () |
void | save (string filename) |
Public Member Functions inherited from OpenCVForUnity.DisposableObject | |
void | Dispose () |
void | ThrowIfDisposed () |
Static Public Member Functions | |
static new StatModel | __fromPtr__ (IntPtr addr) |
Static Public Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm | |
static Algorithm | __fromPtr__ (IntPtr addr) |
Static Public Member Functions inherited from OpenCVForUnity.DisposableObject | |
static IntPtr | ThrowIfNullIntPtr (IntPtr ptr) |
Static Public Attributes | |
const int | COMPRESSED_INPUT = 2 |
const int | PREPROCESSED_INPUT = 4 |
const int | RAW_OUTPUT = 1 |
const int | UPDATE_MODEL = 1 |
Protected Member Functions | |
override void | Dispose (bool disposing) |
Protected Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm | |
Protected Member Functions inherited from OpenCVForUnity.DisposableOpenCVObject | |
DisposableOpenCVObject () | |
DisposableOpenCVObject (bool isEnabledDispose) | |
DisposableOpenCVObject (IntPtr ptr) | |
DisposableOpenCVObject (IntPtr ptr, bool isEnabledDispose) | |
Protected Member Functions inherited from OpenCVForUnity.DisposableObject | |
DisposableObject () | |
DisposableObject (bool isEnabledDispose) | |
Additional Inherited Members | |
Package Functions inherited from OpenCVForUnity.CoreModule.Algorithm | |
Package Attributes inherited from OpenCVForUnity.DisposableOpenCVObject | |
Properties inherited from OpenCVForUnity.DisposableObject | |
bool | IsDisposed [get, protected set] |
bool | IsEnabledDispose [get, set] |
Base class for statistical models in OpenCV ML.
|
static |
Computes error on the training or test dataset.
data | the training data |
test | if true, the error is computed over the test subset of the data, otherwise it's computed over the training subset of the data. Please note that if you loaded a completely different dataset to evaluate already trained classifier, you will probably want not to set the test subset at all with TrainData.setTrainTestSplitRatio and specify test=false, so that the error is computed for the whole new set. Yes, this sounds a bit confusing. |
resp | the optional output responses. |
The method uses StatModel.predict to compute the error. For regression models the error is computed as RMS, for classifiers - as a percent of missclassified samples (0%-100%).
|
protectedvirtual |
Reimplemented from OpenCVForUnity.CoreModule.Algorithm.
Reimplemented in OpenCVForUnity.MlModule.SVM, and OpenCVForUnity.MlModule.SVMSGD.
|
virtual |
Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read.
Reimplemented from OpenCVForUnity.CoreModule.Algorithm.
int OpenCVForUnity.MlModule.StatModel.getVarCount | ( | ) |
Returns the number of variables in training samples.
bool OpenCVForUnity.MlModule.StatModel.isClassifier | ( | ) |
Returns true if the model is classifier.
bool OpenCVForUnity.MlModule.StatModel.isTrained | ( | ) |
Returns true if the model is trained.
|
virtual |
Predicts response(s) for the provided sample(s)
samples | The input samples, floating-point matrix |
results | The optional output matrix of results. |
flags | The optional flags, model-dependent. See cv::ml::StatModel::Flags. |
Reimplemented in OpenCVForUnity.MlModule.EM, and OpenCVForUnity.MlModule.LogisticRegression.
Predicts response(s) for the provided sample(s)
samples | The input samples, floating-point matrix |
results | The optional output matrix of results. |
flags | The optional flags, model-dependent. See cv::ml::StatModel::Flags. |
Reimplemented in OpenCVForUnity.MlModule.EM, and OpenCVForUnity.MlModule.LogisticRegression.
|
virtual |
Predicts response(s) for the provided sample(s)
samples | The input samples, floating-point matrix |
results | The optional output matrix of results. |
flags | The optional flags, model-dependent. See cv::ml::StatModel::Flags. |
Reimplemented in OpenCVForUnity.MlModule.EM, and OpenCVForUnity.MlModule.LogisticRegression.
Trains the statistical model.
samples | training samples |
layout | See ml::SampleTypes. |
responses | vector of responses associated with the training samples. |
bool OpenCVForUnity.MlModule.StatModel.train | ( | TrainData | trainData | ) |
Trains the statistical model.
trainData | training data that can be loaded from file using TrainData::loadFromCSV or created with TrainData.create. |
flags | optional flags, depending on the model. Some of the models can be updated with the new training samples, not completely overwritten (such as NormalBayesClassifier or ANN_MLP). |
bool OpenCVForUnity.MlModule.StatModel.train | ( | TrainData | trainData, |
int | flags ) |
Trains the statistical model.
trainData | training data that can be loaded from file using TrainData::loadFromCSV or created with TrainData.create. |
flags | optional flags, depending on the model. Some of the models can be updated with the new training samples, not completely overwritten (such as NormalBayesClassifier or ANN_MLP). |
|
static |
|
static |
|
static |
|
static |