HaarFeature.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /**
  2. * @file HaarFeature.h
  3. * @brief simple haar like feature
  4. * @author Erik Rodner
  5. * @date 04/21/2008
  6. */
  7. #ifndef HAARFEATUREINCLUDE
  8. #define HAARFEATUREINCLUDE
  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. /** simple haar like feature */
  15. class HaarFeature : public Feature
  16. {
  17. protected:
  18. enum {
  19. HAARTYPE_HORIZONTAL = 0,
  20. HAARTYPE_VERTICAL,
  21. HAARTYPE_DIAGONAL,
  22. HAARTYPE_3BLOCKS,
  23. HAARTYPE_NUMTYPES
  24. };
  25. int type;
  26. int pos1;
  27. int pos2;
  28. int step_x;
  29. int step_y;
  30. int window_size_x;
  31. int window_size_y;
  32. public:
  33. /** simple constructor */
  34. HaarFeature( const NICE::Config *conf );
  35. /** without memory wasting config */
  36. HaarFeature ( int window_size_x,
  37. int window_size_y,
  38. int step_x,
  39. int step_y );
  40. /** simple destructor */
  41. virtual ~HaarFeature();
  42. virtual double val( const Example *example ) const;
  43. void explode ( FeaturePool & featurePool, bool variableWindow ) const;
  44. Feature *clone() const;
  45. void restore (std::istream & is, int format = 0);
  46. void store (std::ostream & os, int format = 0) const;
  47. void clear ();
  48. };
  49. } // namespace
  50. #endif