HistFeature.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /**
  2. * @file HistFeature.h
  3. * @brief histogram integral feature
  4. * @author Erik Rodner
  5. * @date 05/07/2008
  6. */
  7. #ifndef HistFeatureINCLUDE
  8. #define HistFeatureINCLUDE
  9. #include "core/vector/VectorT.h"
  10. #include "core/vector/MatrixT.h"
  11. #include "core/basics/Config.h"
  12. #include "vislearning/cbaselib/Feature.h"
  13. namespace OBJREC {
  14. /** histogram integral feature */
  15. class HistFeature : public Feature
  16. {
  17. protected:
  18. enum {
  19. HISTFEATURE_NORMMETHOD_L1 = 0,
  20. HISTFEATURE_NORMMETHOD_L2
  21. };
  22. /** @{ feature parameter */
  23. int window_size_x;
  24. int window_size_y;
  25. int histtype;
  26. int bin;
  27. int cellx1;
  28. int celly1;
  29. int cellx2;
  30. int celly2;
  31. int cellcountx;
  32. int cellcounty;
  33. int normalizationMethod;
  34. bool flexibleGrid;
  35. /** @} */
  36. /** @{ parameter for feature generation */
  37. int numScales;
  38. int numBins;
  39. double scaleStep;
  40. /** @} */
  41. public:
  42. /** simple constructor */
  43. HistFeature( const NICE::Config *conf,
  44. // refactor-nice.pl: check this substitution
  45. // old: const std::string & section,
  46. const std::string & section,
  47. int _histtype,
  48. int _numBins);
  49. /** internally used by HistFeature::explode */
  50. HistFeature () {};
  51. /** simple destructor */
  52. virtual ~HistFeature();
  53. double val( const Example *example ) const;
  54. void explode ( FeaturePool & featurePool, bool variableWindow = true ) const;
  55. Feature *clone() const;
  56. Feature *generateFirstParameter () const;
  57. void restore (std::istream & is, int format = 0);
  58. void store (std::ostream & os, int format = 0) const;
  59. void clear ();
  60. };
  61. } // namespace
  62. #endif