OpenCV for Unity 2.6.3
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.
Loading...
Searching...
No Matches
OpenCVForUnity.MlModule.RTrees Class Reference

The class implements the random forest predictor. More...

Inheritance diagram for OpenCVForUnity.MlModule.RTrees:
OpenCVForUnity.MlModule.DTrees OpenCVForUnity.MlModule.DTrees OpenCVForUnity.MlModule.DTrees OpenCVForUnity.MlModule.StatModel OpenCVForUnity.MlModule.StatModel OpenCVForUnity.MlModule.StatModel OpenCVForUnity.CoreModule.Algorithm OpenCVForUnity.CoreModule.Algorithm OpenCVForUnity.CoreModule.Algorithm OpenCVForUnity.DisposableOpenCVObject OpenCVForUnity.DisposableOpenCVObject OpenCVForUnity.DisposableOpenCVObject OpenCVForUnity.DisposableObject OpenCVForUnity.DisposableObject OpenCVForUnity.DisposableObject

Public Member Functions

bool getCalculateVarImportance ()
 
void setCalculateVarImportance (bool val)
 
int getActiveVarCount ()
 
void setActiveVarCount (int val)
 
TermCriteria getTermCriteria ()
 
void setTermCriteria (TermCriteria val)
 
Mat getVarImportance ()
 
void getVotes (Mat samples, Mat results, int flags)
 
double getOOBError ()
 
Vec3d getTermCriteriaAsVec3d ()
 
void setTermCriteria (in Vec3d val)
 
double double double epsilon getTermCriteriaAsValueTuple ()
 
void setTermCriteria (in(double type, double maxCount, double epsilon) val)
 
- Public Member Functions inherited from OpenCVForUnity.MlModule.DTrees
int getMaxCategories ()
 
void setMaxCategories (int val)
 
int getMaxDepth ()
 
void setMaxDepth (int val)
 
int getMinSampleCount ()
 
void setMinSampleCount (int val)
 
int getCVFolds ()
 
void setCVFolds (int val)
 
bool getUseSurrogates ()
 
void setUseSurrogates (bool val)
 
bool getUse1SERule ()
 
void setUse1SERule (bool val)
 
bool getTruncatePrunedTree ()
 
void setTruncatePrunedTree (bool val)
 
float getRegressionAccuracy ()
 
void setRegressionAccuracy (float val)
 
Mat getPriors ()
 
void setPriors (Mat val)
 
- Public Member Functions inherited from OpenCVForUnity.MlModule.StatModel
int getVarCount ()
 Returns the number of variables in training samples.
 
override bool empty ()
 Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read.
 
bool isTrained ()
 Returns true if the model is trained.
 
bool isClassifier ()
 Returns true if the model is classifier.
 
bool train (TrainData trainData, int flags)
 Trains the statistical model.
 
bool train (TrainData trainData)
 Trains the statistical model.
 
bool train (Mat samples, int layout, Mat responses)
 Trains the statistical model.
 
float calcError (TrainData data, bool test, Mat resp)
 Computes error on the training or test dataset.
 
virtual float predict (Mat samples, Mat results, int flags)
 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)
 Predicts response(s) for the provided sample(s)
 
- Public Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm
IntPtr getNativeObjAddr ()
 
virtual void clear ()
 Clears the algorithm state.
 
void save (string filename)
 
virtual string getDefaultName ()
 
- Public Member Functions inherited from OpenCVForUnity.DisposableObject
void Dispose ()
 
void ThrowIfDisposed ()
 

Static Public Member Functions

static new RTrees __fromPtr__ (IntPtr addr)
 
static new RTrees create ()
 
static new RTrees load (string filepath, string nodeName)
 Loads and creates a serialized RTree from a file.
 
static new RTrees load (string filepath)
 Loads and creates a serialized RTree from a file.
 
- Static Public Member Functions inherited from OpenCVForUnity.MlModule.DTrees
static new DTrees __fromPtr__ (IntPtr addr)
 
static DTrees create ()
 Creates the empty model.
 
static DTrees load (string filepath, string nodeName)
 Loads and creates a serialized DTrees from a file.
 
static DTrees load (string filepath)
 Loads and creates a serialized DTrees from a file.
 
- Static Public Member Functions inherited from OpenCVForUnity.MlModule.StatModel
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)
 

Public Attributes

double type
 
double double maxCount
 

Protected Member Functions

override void Dispose (bool disposing)
 
- Protected Member Functions inherited from OpenCVForUnity.MlModule.DTrees
- Protected Member Functions inherited from OpenCVForUnity.MlModule.StatModel
override void Dispose (bool disposing)
 
- Protected Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm
- Protected Member Functions inherited from OpenCVForUnity.DisposableOpenCVObject
 DisposableOpenCVObject ()
 
 DisposableOpenCVObject (IntPtr ptr)
 
 DisposableOpenCVObject (bool isEnabledDispose)
 
 DisposableOpenCVObject (IntPtr ptr, bool isEnabledDispose)
 
- Protected Member Functions inherited from OpenCVForUnity.DisposableObject
 DisposableObject ()
 
 DisposableObject (bool isEnabledDispose)
 

Additional Inherited Members

- Static Public Attributes inherited from OpenCVForUnity.MlModule.DTrees
const int PREDICT_AUTO = 0
 
const int PREDICT_SUM = (1 << 8)
 
const int PREDICT_MAX_VOTE = (2 << 8)
 
const int PREDICT_MASK = (3 << 8)
 
- Static Public Attributes inherited from OpenCVForUnity.MlModule.StatModel
const int UPDATE_MODEL = 1
 
const int RAW_OUTPUT = 1
 
const int COMPRESSED_INPUT = 2
 
const int PREPROCESSED_INPUT = 4
 
- Package Functions inherited from OpenCVForUnity.MlModule.DTrees
- Package Functions inherited from OpenCVForUnity.MlModule.StatModel
- 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]
 

Detailed Description

The class implements the random forest predictor.

See also
ml_intro_rtrees

Member Function Documentation

◆ __fromPtr__()

static new RTrees OpenCVForUnity.MlModule.RTrees.__fromPtr__ ( IntPtr addr)
static

◆ create()

static new RTrees OpenCVForUnity.MlModule.RTrees.create ( )
static

Creates the empty model. Use StatModel.train to train the model, StatModel.train to create and train the model, Algorithm::load to load the pre-trained model.

◆ Dispose()

override void OpenCVForUnity.MlModule.RTrees.Dispose ( bool disposing)
protectedvirtual

Reimplemented from OpenCVForUnity.MlModule.DTrees.

◆ getActiveVarCount()

int OpenCVForUnity.MlModule.RTrees.getActiveVarCount ( )

◆ getCalculateVarImportance()

bool OpenCVForUnity.MlModule.RTrees.getCalculateVarImportance ( )

◆ getOOBError()

double OpenCVForUnity.MlModule.RTrees.getOOBError ( )

Returns the OOB error value, computed at the training stage when calcOOBError is set to true. If this flag was set to false, 0 is returned. The OOB error is also scaled by sample weighting.

◆ getTermCriteria()

TermCriteria OpenCVForUnity.MlModule.RTrees.getTermCriteria ( )
See also
setTermCriteria

◆ getTermCriteriaAsValueTuple()

double double double epsilon OpenCVForUnity.MlModule.RTrees.getTermCriteriaAsValueTuple ( )

◆ getTermCriteriaAsVec3d()

Vec3d OpenCVForUnity.MlModule.RTrees.getTermCriteriaAsVec3d ( )
See also
setTermCriteria

◆ getVarImportance()

Mat OpenCVForUnity.MlModule.RTrees.getVarImportance ( )

Returns the variable importance array. The method returns the variable importance vector, computed at the training stage when CalculateVarImportance is set to true. If this flag was set to false, the empty matrix is returned.

◆ getVotes()

void OpenCVForUnity.MlModule.RTrees.getVotes ( Mat samples,
Mat results,
int flags )

Returns the result of each individual tree in the forest. In case the model is a regression problem, the method will return each of the trees' results for each of the sample cases. If the model is a classifier, it will return a Mat with samples + 1 rows, where the first row gives the class number and the following rows return the votes each class had for each sample.

Parameters
samplesArray containing the samples for which votes will be calculated.
resultsArray where the result of the calculation will be written.
flagsFlags for defining the type of RTrees.

◆ load() [1/2]

static new RTrees OpenCVForUnity.MlModule.RTrees.load ( string filepath)
static

Loads and creates a serialized RTree from a file.

Use RTree::save to serialize and store an RTree to disk. Load the RTree from this file again, by calling this function with the path to the file. Optionally specify the node for the file containing the classifier

Parameters
filepathpath to serialized RTree
nodeNamename of node containing the classifier

◆ load() [2/2]

static new RTrees OpenCVForUnity.MlModule.RTrees.load ( string filepath,
string nodeName )
static

Loads and creates a serialized RTree from a file.

Use RTree::save to serialize and store an RTree to disk. Load the RTree from this file again, by calling this function with the path to the file. Optionally specify the node for the file containing the classifier

Parameters
filepathpath to serialized RTree
nodeNamename of node containing the classifier

◆ setActiveVarCount()

void OpenCVForUnity.MlModule.RTrees.setActiveVarCount ( int val)

◆ setCalculateVarImportance()

void OpenCVForUnity.MlModule.RTrees.setCalculateVarImportance ( bool val)

◆ setTermCriteria() [1/3]

void OpenCVForUnity.MlModule.RTrees.setTermCriteria ( in Vec3d val)
See also
getTermCriteria

◆ setTermCriteria() [2/3]

void OpenCVForUnity.MlModule.RTrees.setTermCriteria ( in(double type, double maxCount, double epsilon) val)
See also
getTermCriteria

◆ setTermCriteria() [3/3]

void OpenCVForUnity.MlModule.RTrees.setTermCriteria ( TermCriteria val)
See also
getTermCriteria

Member Data Documentation

◆ maxCount

double double OpenCVForUnity.MlModule.RTrees.maxCount

◆ type

double OpenCVForUnity.MlModule.RTrees.type
See also
setTermCriteria

The documentation for this class was generated from the following files: