mexopencv  3.4.1
MEX interface for OpenCV library
Functions
mexopencv_ml.hpp File Reference

Common definitions for the ml module. More...

#include "mexopencv.hpp"
#include "opencv2/ml.hpp"

Go to the source code of this file.

Functions

MxArray toStruct (const std::vector< cv::ml::DTrees::Node > &nodes)
 Convert tree nodes to struct array. More...
 
MxArray toStruct (const std::vector< cv::ml::DTrees::Split > &splits)
 Convert tree splits to struct array. More...
 
cv::Ptr< cv::ml::TrainDatacreateTrainData (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. More...
 
cv::Ptr< cv::ml::TrainDataloadTrainData (const std::string &filename, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
 Read a dataset from a CSV file. More...
 

Detailed Description

Common definitions for the ml module.

Author
Amro
Date
2015

Header file for MEX-functions that use ML module from OpenCV library. This file includes maps for option processing, as well as functions for creating instances of classes from parsed arguments.

Definition in file mexopencv_ml.hpp.

Function Documentation

◆ createTrainData()

cv::Ptr<cv::ml::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()

cv::Ptr<cv::ml::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.