KMeansMatlab.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. #ifdef NOVISUAL
  10. #include <vislearning/nice_nonvis.h>
  11. #else
  12. #include <vislearning/nice.h>
  13. #endif
  14. #include "core/basics/Config.h"
  15. #include "ClusterAlgorithm.h"
  16. namespace OBJREC {
  17. /** K-Means */
  18. class KMeansMatlab : public ClusterAlgorithm
  19. {
  20. protected:
  21. int noClasses;
  22. // refactor-nice.pl: check this substitution
  23. // old: string kmeansDir;
  24. std::string kmeansDir;
  25. // refactor-nice.pl: check this substitution
  26. // old: string matlabExec;
  27. std::string matlabExec;
  28. // refactor-nice.pl: check this substitution
  29. // old: string matlabArgs;
  30. std::string matlabArgs;
  31. // refactor-nice.pl: check this substitution
  32. // old: string inputFN;
  33. std::string inputFN;
  34. // refactor-nice.pl: check this substitution
  35. // old: string outputFN;
  36. std::string outputFN;
  37. FILE *matlabPipe;
  38. int compute_prototypes ( const NICE::VVector & features,
  39. NICE::VVector & prototypes,
  40. std::vector<double> & weights,
  41. const std::vector<int> & assignment );
  42. public:
  43. /** simple constructor */
  44. KMeansMatlab( const NICE::Config *conf, int noClasses );
  45. /** simple destructor */
  46. virtual ~KMeansMatlab();
  47. void cluster ( const NICE::VVector & features,
  48. NICE::VVector & prototypes,
  49. std::vector<double> & weights,
  50. std::vector<int> & assignment );
  51. };
  52. } // namespace
  53. #endif