123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- /**
- * @file KMeansMatlab.h
- * @brief K-Means using a matlab implementation
- * @author Erik Rodner
- * @date 10/29/2007
- */
- #ifndef KMeansMatlabINCLUDE
- #define KMeansMatlabINCLUDE
- #include "core/vector/VectorT.h"
- #include "core/vector/MatrixT.h"
- #include "core/basics/Config.h"
- #include "ClusterAlgorithm.h"
- namespace OBJREC {
- /**
- * @class KMeansMatlab
- * @brief K-Means using a matlab implementation
- * @author Erik Rodner
- */
- class KMeansMatlab : public ClusterAlgorithm
- {
- protected:
-
- /************************
- *
- * protected variables
- *
- **************************/
- int noClusters;
- // refactor-nice.pl: check this substitution
- // old: string kmeansDir;
- std::string kmeansDir;
- // refactor-nice.pl: check this substitution
- // old: string matlabExec;
- std::string matlabExec;
- // refactor-nice.pl: check this substitution
- // old: string matlabArgs;
- std::string matlabArgs;
- // refactor-nice.pl: check this substitution
- // old: string inputFN;
- std::string inputFN;
- // refactor-nice.pl: check this substitution
- // old: string outputFN;
- std::string outputFN;
- FILE *matlabPipe;
-
- /************************
- *
- * protected methods
- *
- **************************/
-
- int compute_prototypes ( const NICE::VVector & features,
- NICE::VVector & prototypes,
- std::vector<double> & weights,
- const std::vector<int> & assignment );
- public:
-
- ///////////////////// ///////////////////// /////////////////////
- // CONSTRUCTORS / DESTRUCTORS
- ///////////////////// ///////////////////// /////////////////////
-
- /**
- * @brief default constructor
- * @date 13-02-2014 (dd-mm-yyyy )
- * @author Alexander Freytag
- */
- KMeansMatlab ( );
-
- /**
- * @brief simple constructor
- * @author Erik Rodner, Alexander Freytag
- * Among others, you can specify for "section" the following attributes: "source_root", "tmpInput", "tmpOutput", "matlab_exec", "matlab_args"
- */
- KMeansMatlab( const NICE::Config * _conf, const std::string & _confSection = "KMeansMatlab" );
-
- /** simple destructor */
- virtual ~KMeansMatlab();
-
- /**
- * @brief Jobs previously performed in the config-version of the constructor, read settings etc.
- * @author Alexander Freytag
- * @date 13-02-2014 ( dd-mm-yyyy )
- */
- void initFromConfig ( const NICE::Config * _conf, const std::string & _confSection = "KMeansMatlab");
-
- ///////////////////// ///////////////////// /////////////////////
- // CLUSTERING STUFF
- ///////////////////// ///////////////////// //////////////////
-
- void cluster ( const NICE::VVector & features,
- NICE::VVector & prototypes,
- std::vector<double> & weights,
- std::vector<int> & assignment );
-
- ///////////////////// INTERFACE PERSISTENT /////////////////////
- // interface specific methods for store and restore
- ///////////////////// INTERFACE PERSISTENT /////////////////////
-
- /**
- * @brief Load object from external file (stream)
- * @author Alexander Freytag
- * @date 13-02-2014 ( dd-mm-yyyy )
- */
- void restore ( std::istream & is, int format = 0 );
- /**
- * @brief Save object to external file (stream)
- * @author Alexander Freytag
- * @date 13-02-2014 ( dd-mm-yyyy )
- */
- void store ( std::ostream & os, int format = 0 ) const;
- /**
- * @brief Clear object
- * @author Alexander Freytag
- * @date 13-02-2014 ( dd-mm-yyyy )
- */
- void clear ();
- };
- } // namespace
- #endif
|