HaarFeature.h 1.2 KB

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