mexopencv  0.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::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. More...
 
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. 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

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
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
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
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