123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- /**
- * @file CodebookPrototypes.h
- * @brief feature CodebookPrototypes
- * @author Erik Rodner, Alexander Freytag
- * @date 05-06-2013 (dd-mm-yyyy ) (original: 02/15/2008)
- */
- #ifndef CodebookPrototypesINCLUDE
- #define CodebookPrototypesINCLUDE
- #include "core/vector/VectorT.h"
- #include "core/vector/MatrixT.h"
- #include <string>
- #include "core/vector/VVector.h"
- #include <core/vector/Distance.h>
- #include "Codebook.h"
- namespace OBJREC {
- /** feature CodebookPrototypes */
- class CodebookPrototypes : public Codebook, public NICE::VVector
- {
- protected:
-
- //! specify which distance to use for calculating assignments
- std::string distanceType;
-
- //! the actual distance metric
- NICE::VectorDistance<double> *distancefunction;
- public:
-
- /** simple constructor */
- CodebookPrototypes();
-
- /** constructor reading the codebook from a file*/
- CodebookPrototypes( const std::string & filename );
-
- /** constructor taking the given VVector as new codebook prototypes*/
- CodebookPrototypes( const NICE::VVector & vv );
-
- /** copy constructor*/
- CodebookPrototypes( const CodebookPrototypes *cs );
-
- /** recommended constructor*/
- CodebookPrototypes( NICE::Config * _conf, const std::string & _section);
-
- /** simple destructor */
- virtual ~CodebookPrototypes();
-
- //vote for a single feature vector
- /**
- * @brief Vector Quantization for a single vector
- */
- void voteVQ ( const NICE::Vector & feature, int & codebookEntry, double & weight, double & distance ) const;
- /**
- * @brief Hard or Soft Assignment into NICE::Vector for a single vector
- */
- virtual void voteVA ( const NICE::Vector & feature, NICE::Vector & votes ) const;
- /**
- * @brief Hard or Soft Assignment into NICE::SparseVector for a single vector
- */
- virtual void voteVA ( const NICE::Vector & feature, NICE::SparseVector & votes ) const;
-
-
- void add ( const Codebook *codebook );
- void copy ( const Codebook *codebook );
- Codebook *clone () const;
- void clear ();
- void restore ( std::istream & is, int format );
- void store ( std::ostream & os, int format ) const;
- void displayCodebook (int xsize, int ysize) const;
- };
- } // namespace
- #endif
|