HistFeature.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. #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 "vislearning/cbaselib/Feature.h"
  16. namespace OBJREC {
  17. /** histogram integral feature */
  18. class HistFeature : public Feature
  19. {
  20. protected:
  21. enum {
  22. HISTFEATURE_NORMMETHOD_L1 = 0,
  23. HISTFEATURE_NORMMETHOD_L2
  24. };
  25. /** @{ feature parameter */
  26. int window_size_x;
  27. int window_size_y;
  28. int histtype;
  29. int bin;
  30. int cellx1;
  31. int celly1;
  32. int cellx2;
  33. int celly2;
  34. int cellcountx;
  35. int cellcounty;
  36. int normalizationMethod;
  37. bool flexibleGrid;
  38. /** @} */
  39. /** @{ parameter for feature generation */
  40. int numScales;
  41. int numBins;
  42. double scaleStep;
  43. /** @} */
  44. public:
  45. /** simple constructor */
  46. HistFeature( const NICE::Config *conf,
  47. // refactor-nice.pl: check this substitution
  48. // old: const std::string & section,
  49. const std::string & section,
  50. int _histtype,
  51. int _numBins);
  52. /** internally used by HistFeature::explode */
  53. HistFeature () {};
  54. /** simple destructor */
  55. virtual ~HistFeature();
  56. double val( const Example *example ) const;
  57. void explode ( FeaturePool & featurePool, bool variableWindow = true ) const;
  58. Feature *clone() const;
  59. Feature *generateFirstParameter () const;
  60. void restore (std::istream & is, int format = 0);
  61. void store (std::ostream & os, int format = 0) const;
  62. void clear ();
  63. };
  64. } // namespace
  65. #endif