/** * @file Feature.h * @brief abstraction of a feature * @author Erik Rodner * @date 04/21/2008 */ #ifndef FEATUREINCLUDE #define FEATUREINCLUDE #include #include #include "vislearning/cbaselib/CachedExample.h" #include "vislearning/cbaselib/Example.h" #include "core/basics/Persistent.h" #include "core/basics/triplet.h" #include "core/basics/quadruplet.h" //#include "FeaturePool.h" namespace OBJREC { class FeaturePool; #define ROADWORKS { fprintf(stderr, "not yet implemented !\n"); exit(-1); } /* stores a sorted set of feature values: value classno index weight **/ class FeatureValues : public std::set< NICE::quadruplet > {}; class FeatureStorage : public std::map< int, FeatureValues > {}; /* stores an unsorted set of feature values: value classno index weight **/ class FeatureValuesUnsorted : public std::vector< NICE::quadruplet > {}; class FeatureStorageUnsorted : public std::map< int, FeatureValuesUnsorted > {}; /** abstraction of a feature */ class Feature : public NICE::Persistent { protected: public: /** simple constructor */ Feature(); /** simple destructor */ virtual ~Feature(); virtual double val( const Example *example ) const = 0; virtual Feature *clone() const = 0; virtual void explode ( FeaturePool & featurePool, bool variableWindow = true ) const = 0; virtual void calcFeatureValues ( const Examples & examples, std::vector & examples_selection, FeatureValuesUnsorted & values ) const; virtual void calcFeatureValues ( const Examples & examples, std::vector & examples_selection, FeatureValues & values ) const; }; } // namespace #undef ROADWORKS #endif