KMeansMatlab.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /**
  2. * @file KMeansMatlab.h
  3. * @brief K-Means using a matlab implementation
  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. /**
  15. * @class KMeansMatlab
  16. * @brief K-Means using a matlab implementation
  17. * @author Erik Rodner
  18. */
  19. class KMeansMatlab : public ClusterAlgorithm
  20. {
  21. protected:
  22. int noClusters;
  23. // refactor-nice.pl: check this substitution
  24. // old: string kmeansDir;
  25. std::string kmeansDir;
  26. // refactor-nice.pl: check this substitution
  27. // old: string matlabExec;
  28. std::string matlabExec;
  29. // refactor-nice.pl: check this substitution
  30. // old: string matlabArgs;
  31. std::string matlabArgs;
  32. // refactor-nice.pl: check this substitution
  33. // old: string inputFN;
  34. std::string inputFN;
  35. // refactor-nice.pl: check this substitution
  36. // old: string outputFN;
  37. std::string outputFN;
  38. FILE *matlabPipe;
  39. int compute_prototypes ( const NICE::VVector & features,
  40. NICE::VVector & prototypes,
  41. std::vector<double> & weights,
  42. const std::vector<int> & assignment );
  43. public:
  44. /**
  45. * @brief simple constructor
  46. * @author Erik Rodner, Alexander Freytag
  47. * Among others, you can specify for "section" the following attributes: "source_root", "tmpInput", "tmpOutput", "matlab_exec", "matlab_args"
  48. */
  49. KMeansMatlab( const NICE::Config *conf, const std::string & _section = "KMeansMatlab" );
  50. /** simple destructor */
  51. virtual ~KMeansMatlab();
  52. void cluster ( const NICE::VVector & features,
  53. NICE::VVector & prototypes,
  54. std::vector<double> & weights,
  55. std::vector<int> & assignment );
  56. };
  57. } // namespace
  58. #endif