KMeansMatlab.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /**
  2. * @file KMeansMatlab.h
  3. * @brief K-Means
  4. * @author Erik Rodner
  5. * @date 10/29/2007
  6. */
  7. #ifndef KMeansMatlabINCLUDE
  8. #define KMeansMatlabINCLUDE
  9. #include "core/vector/VectorT.h"
  10. #include "core/vector/MatrixT.h"
  11. #include "core/basics/Config.h"
  12. #include "ClusterAlgorithm.h"
  13. namespace OBJREC {
  14. /** K-Means */
  15. class KMeansMatlab : public ClusterAlgorithm
  16. {
  17. protected:
  18. int noClasses;
  19. // refactor-nice.pl: check this substitution
  20. // old: string kmeansDir;
  21. std::string kmeansDir;
  22. // refactor-nice.pl: check this substitution
  23. // old: string matlabExec;
  24. std::string matlabExec;
  25. // refactor-nice.pl: check this substitution
  26. // old: string matlabArgs;
  27. std::string matlabArgs;
  28. // refactor-nice.pl: check this substitution
  29. // old: string inputFN;
  30. std::string inputFN;
  31. // refactor-nice.pl: check this substitution
  32. // old: string outputFN;
  33. std::string outputFN;
  34. FILE *matlabPipe;
  35. int compute_prototypes ( const NICE::VVector & features,
  36. NICE::VVector & prototypes,
  37. std::vector<double> & weights,
  38. const std::vector<int> & assignment );
  39. public:
  40. /** simple constructor */
  41. KMeansMatlab( const NICE::Config *conf, int noClasses );
  42. /** simple destructor */
  43. virtual ~KMeansMatlab();
  44. void cluster ( const NICE::VVector & features,
  45. NICE::VVector & prototypes,
  46. std::vector<double> & weights,
  47. std::vector<int> & assignment );
  48. };
  49. } // namespace
  50. #endif