OpenCV  2.4.13
Open Source Computer Vision
cv::EM Class Reference

#include <ml.hpp>

Inheritance diagram for cv::EM:
cv::Algorithm

Public Types

enum  { COV_MAT_SPHERICAL =0, COV_MAT_DIAGONAL =1, COV_MAT_GENERIC =2, COV_MAT_DEFAULT =COV_MAT_DIAGONAL }
 
enum  { DEFAULT_NCLUSTERS =5, DEFAULT_MAX_ITERS =100 }
 
enum  { START_E_STEP =1, START_M_STEP =2, START_AUTO_STEP =0 }
 
- Public Types inherited from cv::Algorithm
typedef Algorithm *(* Constructor) (void)
 
typedef int(Algorithm::* Getter) () const
 
typedef void(Algorithm::* Setter) (int)
 

Public Member Functions

 EM (int nclusters=EM::DEFAULT_NCLUSTERS, int covMatType=EM::COV_MAT_DIAGONAL, const TermCriteria &termCrit=TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, EM::DEFAULT_MAX_ITERS, FLT_EPSILON))
 
virtual ~EM ()
 
virtual void clear ()
 
virtual bool train (InputArray samples, OutputArray logLikelihoods=noArray(), OutputArray labels=noArray(), OutputArray probs=noArray())
 
virtual bool trainE (InputArray samples, InputArray means0, InputArray covs0=noArray(), InputArray weights0=noArray(), OutputArray logLikelihoods=noArray(), OutputArray labels=noArray(), OutputArray probs=noArray())
 
virtual bool trainM (InputArray samples, InputArray probs0, OutputArray logLikelihoods=noArray(), OutputArray labels=noArray(), OutputArray probs=noArray())
 
Vec2d predict (InputArray sample, OutputArray probs=noArray()) const
 
bool isTrained () const
 
AlgorithmInfoinfo () const
 
virtual void read (const FileNode &fn)
 
- Public Member Functions inherited from cv::Algorithm
 Algorithm ()
 
virtual ~Algorithm ()
 
string name () const
 
template<typename _Tp >
ParamType< _Tp >::member_type get (const string &name) const
 
template<typename _Tp >
ParamType< _Tp >::member_type get (const char *name) const
 
int getInt (const string &name) const
 
double getDouble (const string &name) const
 
bool getBool (const string &name) const
 
string getString (const string &name) const
 
Mat getMat (const string &name) const
 
vector< MatgetMatVector (const string &name) const
 
Ptr< AlgorithmgetAlgorithm (const string &name) const
 
void set (const string &name, int value)
 
void set (const string &name, double value)
 
void set (const string &name, bool value)
 
void set (const string &name, const string &value)
 
void set (const string &name, const Mat &value)
 
void set (const string &name, const vector< Mat > &value)
 
void set (const string &name, const Ptr< Algorithm > &value)
 
template<typename _Tp >
void set (const string &name, const Ptr< _Tp > &value)
 
void setInt (const string &name, int value)
 
void setDouble (const string &name, double value)
 
void setBool (const string &name, bool value)
 
void setString (const string &name, const string &value)
 
void setMat (const string &name, const Mat &value)
 
void setMatVector (const string &name, const vector< Mat > &value)
 
void setAlgorithm (const string &name, const Ptr< Algorithm > &value)
 
template<typename _Tp >
void setAlgorithm (const string &name, const Ptr< _Tp > &value)
 
void set (const char *name, int value)
 
void set (const char *name, double value)
 
void set (const char *name, bool value)
 
void set (const char *name, const string &value)
 
void set (const char *name, const Mat &value)
 
void set (const char *name, const vector< Mat > &value)
 
void set (const char *name, const Ptr< Algorithm > &value)
 
template<typename _Tp >
void set (const char *name, const Ptr< _Tp > &value)
 
void setInt (const char *name, int value)
 
void setDouble (const char *name, double value)
 
void setBool (const char *name, bool value)
 
void setString (const char *name, const string &value)
 
void setMat (const char *name, const Mat &value)
 
void setMatVector (const char *name, const vector< Mat > &value)
 
void setAlgorithm (const char *name, const Ptr< Algorithm > &value)
 
template<typename _Tp >
void setAlgorithm (const char *name, const Ptr< _Tp > &value)
 
string paramHelp (const string &name) const
 
int paramType (const char *name) const
 
int paramType (const string &name) const
 
void getParams (CV_OUT vector< string > &names) const
 
virtual void write (FileStorage &fs) const
 

Protected Member Functions

virtual void setTrainData (int startStep, const Mat &samples, const Mat *probs0, const Mat *means0, const vector< Mat > *covs0, const Mat *weights0)
 
bool doTrain (int startStep, OutputArray logLikelihoods, OutputArray labels, OutputArray probs)
 
virtual void eStep ()
 
virtual void mStep ()
 
void clusterTrainSamples ()
 
void decomposeCovs ()
 
void computeLogWeightDivDet ()
 
Vec2d computeProbabilities (const Mat &sample, Mat *probs) const
 

Protected Attributes

int nclusters
 
int covMatType
 
int maxIters
 
double epsilon
 
Mat trainSamples
 
Mat trainProbs
 
Mat trainLogLikelihoods
 
Mat trainLabels
 
CV_PROP Mat weights
 
CV_PROP Mat means
 
CV_PROP vector< Matcovs
 
vector< MatcovsEigenValues
 
vector< MatcovsRotateMats
 
vector< MatinvCovsEigenValues
 
Mat logWeightDivDet
 

Additional Inherited Members

- Static Public Member Functions inherited from cv::Algorithm
static void getList (CV_OUT vector< string > &algorithms)
 
static Ptr< Algorithm_create (const string &name)
 
template<typename _Tp >
static Ptr< _Tp > create (const string &name)
 

Member Enumeration Documentation

anonymous enum
Enumerator
COV_MAT_SPHERICAL 
COV_MAT_DIAGONAL 
COV_MAT_GENERIC 
COV_MAT_DEFAULT 
anonymous enum
Enumerator
DEFAULT_NCLUSTERS 
DEFAULT_MAX_ITERS 
anonymous enum
Enumerator
START_E_STEP 
START_M_STEP 
START_AUTO_STEP 

Constructor & Destructor Documentation

cv::EM::EM ( int  nclusters = EM::DEFAULT_NCLUSTERS,
int  covMatType = EM::COV_MAT_DIAGONAL,
const TermCriteria termCrit = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS,                                                                                                                                                                                           EM::DEFAULT_MAX_ITERS, FLT_EPSILON) 
)
virtual cv::EM::~EM ( )
virtual

Member Function Documentation

virtual void cv::EM::clear ( )
virtual
void cv::EM::clusterTrainSamples ( )
protected
void cv::EM::computeLogWeightDivDet ( )
protected
Vec2d cv::EM::computeProbabilities ( const Mat sample,
Mat probs 
) const
protected
void cv::EM::decomposeCovs ( )
protected
bool cv::EM::doTrain ( int  startStep,
OutputArray  logLikelihoods,
OutputArray  labels,
OutputArray  probs 
)
protected
virtual void cv::EM::eStep ( )
protectedvirtual
AlgorithmInfo* cv::EM::info ( ) const
virtual

Reimplemented from cv::Algorithm.

bool cv::EM::isTrained ( ) const
virtual void cv::EM::mStep ( )
protectedvirtual
Vec2d cv::EM::predict ( InputArray  sample,
OutputArray  probs = noArray() 
) const
virtual void cv::EM::read ( const FileNode fn)
virtual

Reimplemented from cv::Algorithm.

virtual void cv::EM::setTrainData ( int  startStep,
const Mat samples,
const Mat probs0,
const Mat means0,
const vector< Mat > *  covs0,
const Mat weights0 
)
protectedvirtual
virtual bool cv::EM::train ( InputArray  samples,
OutputArray  logLikelihoods = noArray(),
OutputArray  labels = noArray(),
OutputArray  probs = noArray() 
)
virtual
virtual bool cv::EM::trainE ( InputArray  samples,
InputArray  means0,
InputArray  covs0 = noArray(),
InputArray  weights0 = noArray(),
OutputArray  logLikelihoods = noArray(),
OutputArray  labels = noArray(),
OutputArray  probs = noArray() 
)
virtual
virtual bool cv::EM::trainM ( InputArray  samples,
InputArray  probs0,
OutputArray  logLikelihoods = noArray(),
OutputArray  labels = noArray(),
OutputArray  probs = noArray() 
)
virtual

Member Data Documentation

int cv::EM::covMatType
protected
CV_PROP vector<Mat> cv::EM::covs
protected
vector<Mat> cv::EM::covsEigenValues
protected
vector<Mat> cv::EM::covsRotateMats
protected
double cv::EM::epsilon
protected
vector<Mat> cv::EM::invCovsEigenValues
protected
Mat cv::EM::logWeightDivDet
protected
int cv::EM::maxIters
protected
CV_PROP Mat cv::EM::means
protected
int cv::EM::nclusters
protected
Mat cv::EM::trainLabels
protected
Mat cv::EM::trainLogLikelihoods
protected
Mat cv::EM::trainProbs
protected
Mat cv::EM::trainSamples
protected
CV_PROP Mat cv::EM::weights
protected

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