FeaturePool.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /**
  2. * @file FeaturePool.h
  3. * @brief collection of features
  4. * @author Erik Rodner
  5. * @date 04/21/2008
  6. */
  7. #ifndef FEATUREPOOLINCLUDE
  8. #define FEATUREPOOLINCLUDE
  9. #include "Feature.h"
  10. #include "core/basics/Persistent.h"
  11. #include "core/basics/Config.h"
  12. #include "vislearning/cbaselib/CachedExample.h"
  13. namespace OBJREC {
  14. /** collection of features */
  15. class FeaturePool : public std::vector< std::pair<double, Feature *> >, public NICE::Persistent
  16. {
  17. protected:
  18. std::vector<double> cumsum;
  19. const NICE::Config *conf;
  20. public:
  21. /** simple constructor */
  22. FeaturePool();
  23. /** constructor uses config */
  24. FeaturePool( const NICE::Config *conf );
  25. /** simple destructor */
  26. virtual ~FeaturePool();
  27. Feature *getRandomFeature () const;
  28. void initRandomFeatureSelection ();
  29. void addFeature ( Feature *f, double probability = 1.0 );
  30. void calcFeatureVector ( const Example & pe, NICE::Vector & x ) const;
  31. void destroy ();
  32. virtual void restore (std::istream & is, int format = 0);
  33. virtual void store (std::ostream & os, int format = 0) const;
  34. virtual void clear ();
  35. };
  36. } // namespace
  37. #endif