12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- /**
- * @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/SparseVectorT.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
|