PixelPairFeature.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /**
  2. * @file PixelPairFeature.h
  3. * @brief like in Shotton paper
  4. * @author Erik Rodner
  5. * @date 04/21/2008
  6. */
  7. #ifndef PixelPairFeatureINCLUDE
  8. #define PixelPairFeatureINCLUDE
  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 PixelPairFeature : public Feature
  19. {
  20. protected:
  21. enum {
  22. PPTYPE_DIFF = 0,
  23. PPTYPE_ABSDIFF,
  24. PPTYPE_SUM,
  25. PPTYPE_VALUE
  26. };
  27. int type;
  28. int imagetype;
  29. int x1;
  30. int y1;
  31. int b1;
  32. int x2;
  33. int y2;
  34. int b2;
  35. int step_x;
  36. int step_y;
  37. int window_size_x;
  38. int window_size_y;
  39. public:
  40. /** simple constructor */
  41. PixelPairFeature( const NICE::Config *conf );
  42. /** without memory wasting config */
  43. PixelPairFeature ( int window_size_x,
  44. int window_size_y,
  45. int step_x,
  46. int step_y,
  47. int imagetype );
  48. /** simple destructor */
  49. virtual ~PixelPairFeature();
  50. double val( const Example *example ) const;
  51. void explode ( FeaturePool & featurePool, bool variableWindow = true ) const;
  52. Feature *clone() const;
  53. void restore (std::istream & is, int format = 0);
  54. void store (std::ostream & os, int format = 0) const;
  55. void clear ();
  56. #if 0
  57. void calcFeatureValues ( const Examples & examples,
  58. std::vector<int> & examples_selection,
  59. FeatureValuesUnsorted & values ) const;
  60. #endif
  61. };
  62. } // namespace
  63. #endif