/** * @file Codebook.h * @brief feature codebook * @author Erik Rodner * @date 02/15/2008 */ #ifndef CODEBOOKINCLUDE #define CODEBOOKINCLUDE #include "core/vector/VectorT.h" #include "core/vector/MatrixT.h" #include "core/image/ImageT.h" #include "core/imagedisplay/ImageDisplay.h" #include #include "core/basics/Persistent.h" #include "core/vector/SparseVectorT.h" namespace OBJREC { /** feature codebook */ class Codebook : public NICE::Persistent { protected: NICE::Vector thresholds; NICE::Vector informativeMeasure; NICE::VectorT classnos; public: /** simple destructor */ virtual ~Codebook() {}; virtual void vote ( const NICE::Vector & feature, int & codebookEntry, double & weight, double & distance ) const = 0; virtual void vote ( const NICE::Vector & feature, NICE::Vector & histogram, int & codebookEntry, double & weight, double & distance ) const; virtual void vote ( const NICE::Vector & feature, NICE::SparseVector & votes ) const; virtual bool allowsMultipleVoting () { return false; }; virtual void add ( const Codebook *codebook ) = 0; virtual void copy ( const Codebook *codebook ); virtual Codebook *clone () const = 0; size_t getCodebookSize() const { return informativeMeasure.size(); }; void reinit ( int numCodebookEntries ); const NICE::Vector & getThresholds () const { return thresholds; }; const NICE::Vector & getInformativeMeasure () const { return informativeMeasure; }; const NICE::VectorT & getClassNos () const { return classnos; }; void setThresholds ( const NICE::Vector & _thresholds ) { thresholds = _thresholds; }; void setInformativeMeasure ( const NICE::Vector & _informativeMeasure ) { informativeMeasure = _informativeMeasure; }; void setClassNos ( const NICE::VectorT & _classnos ) { classnos = _classnos; }; virtual void clear (); virtual void restore ( std::istream & is, int format ); virtual void store ( std::ostream & os, int format ) const; }; } // namespace #endif