/** * @file BoWFeatureConverter.h * @brief Convert a set of features into a Bag of visual Words histogram (either by Vector Quantization, or Hard / Soft Assignment) * @author Alexander Freytag * @date 11-06-2013 (dd-mm-yyyy) */ #ifndef BOWFEATURECONVERTERINCLUDE #define BOWFEATURECONVERTERINCLUDE #include "core/vector/VectorT.h" #include "core/vector/VVector.h" #include "core/vector/MatrixT.h" #include "core/basics/Config.h" #include "Codebook.h" namespace OBJREC { /** * @class BoWFeatureConverter * @brief Convert a set of features into a Bag of visual Words histogram (either by Vector Quantization, or Hard / Soft Assignment) * @author Alexander Freytag * @date 11-06-2013 (dd-mm-yyyy) */ class BoWFeatureConverter { protected: //! normalization method used (enum type) int n_normalizationMethod; //! quantization method used (enum type) int n_quantizationMethod; //! pointer to our codebook const Codebook *codebook; //! the section name if we want to read something from the config file lateron std::string s_section; //! the config file to specify parameter settings const NICE::Config * p_conf; public: //! enum type used for normalization method enum { NORMALIZE_RAW = 0, NORMALIZE_BINZERO, NORMALIZE_SUM, NORMALIZE_THRESH }; //! enum type used to specify feature -> clusters (vector quant. , or vector assignment (either hard or soft) ) enum { VECTOR_QUANTIZATION = 0, VECTOR_ASSIGNMENT }; /** * @brief standard constructor * * @param conf pointer to a Config object with some parameter settings (currently not used) * @param codebook pointer to the codebook (keep the pointer!) */ BoWFeatureConverter( const NICE::Config *conf, const Codebook *codebook, const std::string _section = "BoWFeatureConverter" ); /** simple destructor */ virtual ~BoWFeatureConverter(); void calcHistogram ( const NICE::VVector & features, NICE::Vector & histogram, const bool & b_resetHistogram = true ); void normalizeHistogram ( NICE::Vector & histogram ); /** * @brief set the type of the normalization method (see the enum of the class) * * @param normalizationMethod see enum type */ void setNormalizationMethod ( int normalizationMethod ); /** * @brief get the currently used normalization method * * @return see enum type */ int getNormalizationMethod () const; }; } // namespace #endif