HistFeature.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. const std::string & section,
  45. int _histtype,
  46. int _numBins );
  47. /** internally used by HistFeature::explode */
  48. HistFeature () {};
  49. /** simple destructor */
  50. virtual ~HistFeature();
  51. double val ( const Example *example ) const;
  52. void explode ( FeaturePool & featurePool, bool variableWindow = true ) const;
  53. Feature *clone() const;
  54. Feature *generateFirstParameter () const;
  55. void restore ( std::istream & is, int format = 0 );
  56. void store ( std::ostream & os, int format = 0 ) const;
  57. void clear ();
  58. };
  59. } // namespace
  60. #endif