123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- /**
- * @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 <string>
- #include "core/basics/Persistent.h"
- #include "core/vector/SparseVector.h"
- namespace OBJREC {
- /** feature codebook */
- class Codebook : public NICE::Persistent
- {
- protected:
- NICE::Vector thresholds;
- NICE::Vector informativeMeasure;
- NICE::VectorT<int> 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<int> & 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<int> & _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
|