mexopencv  3.4.1
MEX interface for OpenCV library
Functions | Variables
mexopencv_ml.cpp File Reference

Implementation of mexopencv_ml. More...

#include "mexopencv_ml.hpp"

Go to the source code of this file.

Functions

MxArray toStruct (const vector< DTrees::Node > &nodes)
 Convert tree nodes to struct array. More...
 
MxArray toStruct (const vector< DTrees::Split > &splits)
 Convert tree splits to struct array. More...
 
Ptr< TrainDatacreateTrainData (const Mat &samples, const Mat &responses, vector< MxArray >::const_iterator first, vector< MxArray >::const_iterator last)
 Create an instance of TrainData using options in arguments. More...
 
Ptr< TrainDataloadTrainData (const string &filename, vector< MxArray >::const_iterator first, vector< MxArray >::const_iterator last)
 Read a dataset from a CSV file. More...
 

Variables

const ConstMap< string, int > SampleTypesMap
 Option values for sample layouts. More...
 
const ConstMap< string, int > VariableTypeMap
 Option values for variable types. More...
 

Detailed Description

Implementation of mexopencv_ml.

Author
Amro
Date
2015

Definition in file mexopencv_ml.cpp.

Function Documentation

◆ createTrainData()

Ptr<TrainData> createTrainData ( const cv::Mat samples,
const cv::Mat responses,
std::vector< MxArray >::const_iterator  first,
std::vector< MxArray >::const_iterator  last 
)

Create an instance of TrainData using options in arguments.

Parameters
samplesdata samples
responsesdata responses
firstiterator at the beginning of the vector range
lastiterator at the end of the vector range
Returns
smart pointer to created cv::ml::TrainData

Definition at line 70 of file mexopencv_ml.cpp.

◆ loadTrainData()

Ptr<TrainData> loadTrainData ( const std::string filename,
std::vector< MxArray >::const_iterator  first,
std::vector< MxArray >::const_iterator  last 
)

Read a dataset from a CSV file.

Parameters
filenameThe input CSV file name
firstiterator at the beginning of the vector range
lastiterator at the end of the vector range
Returns
smart pointer to created cv::ml::TrainData

Definition at line 134 of file mexopencv_ml.cpp.

◆ toStruct() [1/2]

MxArray toStruct ( const std::vector< cv::ml::DTrees::Node > &  nodes)

Convert tree nodes to struct array.

Parameters
nodesvector of decision tree nodes
Returns
struct-array MxArray object

Definition at line 34 of file mexopencv_ml.cpp.

◆ toStruct() [2/2]

MxArray toStruct ( const std::vector< cv::ml::DTrees::Split > &  splits)

Convert tree splits to struct array.

Parameters
splitsvector of decision tree splits
Returns
struct-array MxArray object

Definition at line 51 of file mexopencv_ml.cpp.

Variable Documentation

◆ SampleTypesMap

const ConstMap<string, int> SampleTypesMap
Initial value:
std::map wrapper with one-line initialization and lookup method.
Definition: MxArray.hpp:927

Option values for sample layouts.

Definition at line 18 of file mexopencv_ml.cpp.

◆ VariableTypeMap

const ConstMap<string, int> VariableTypeMap
Initial value:
("Numerical", cv::ml::VAR_NUMERICAL)
("Ordered", cv::ml::VAR_ORDERED)
("Categorical", cv::ml::VAR_CATEGORICAL)
std::map wrapper with one-line initialization and lookup method.
Definition: MxArray.hpp:927

Option values for variable types.

Definition at line 23 of file mexopencv_ml.cpp.