FCCodebookHistBin.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /**
  2. * @file FCCodebookHistBin.h
  3. * @brief create features with codebook
  4. * @author Erik Rodner
  5. * @date 02/05/2008
  6. */
  7. #ifndef FCCODEBOOKHISTBININCLUDE
  8. #define FCCODEBOOKHISTBININCLUDE
  9. #ifdef NOVISUAL
  10. #include <vislearning/nice_nonvis.h>
  11. #else
  12. #include <vislearning/nice.h>
  13. #endif
  14. #include "core/basics/Config.h"
  15. #include "vislearning/features/fbase/FeatureFactory.h"
  16. #include "vislearning/features/localfeatures/LocalFeatureRepresentation.h"
  17. #include "Codebook.h"
  18. namespace OBJREC {
  19. /** create features with codebook */
  20. class FCCodebookHistBin : public FeatureFactory
  21. {
  22. protected:
  23. int n_method;
  24. const LocalFeatureRepresentation *lfrep;
  25. const Codebook *codebook;
  26. void calcHistogram ( const NICE::VVector & features,
  27. NICE::Vector & histogram );
  28. void calcHistogram ( const NICE::VVector & features,
  29. NICE::Vector & histogram,
  30. NICE::Matrix & assignments);
  31. void normalizeHistogram ( NICE::Vector & histogram );
  32. public:
  33. enum {
  34. NORMALIZE_RAW = 0,
  35. NORMALIZE_BINZERO,
  36. NORMALIZE_SUM,
  37. NORMALIZE_THRESH
  38. };
  39. /** simple constructor */
  40. FCCodebookHistBin( const NICE::Config *conf,
  41. const LocalFeatureRepresentation *lfrep,
  42. const std::string & normalizationMethod,
  43. const Codebook *codebook );
  44. /** simple destructor */
  45. virtual ~FCCodebookHistBin();
  46. int convert ( const NICE::Image & img, NICE::Vector & vec );
  47. int calcAssignments ( const NICE::VVector & features, NICE::Vector & vec, NICE::Matrix & assignments );
  48. void setNormalizationMethod ( int normalizationMethod );
  49. int getNormalizationMethod () const;
  50. };
  51. } // namespace
  52. #endif