/** * @file LocalFeatureColorWeijer.cpp * @brief implementation of the color features mentioned in van de Weijer, J. & Schmid, C. Applying Color Names to Image Description (2007) * @author Björn Fröhlich * @date 01/28/2010 */ #ifndef LFColorWeijerINCLUDE #define LFColorWeijerINCLUDE // nice-core includes #include // #include #include #include // #include #include // nice-vislearning includes #include "LocalFeature.h" namespace OBJREC { /** interface to ColorSande implementation */ class LocalFeatureColorWeijer : public LocalFeature { protected: //! enum for 11 main colors enum { BLACK = 0, BLUE, BROWN, GREY, GREEN, ORANGE, PINK, PURPLE, RED, WHITE, YELLOW, LASTCOLOR }; //! lookup table double hist[32][32][32][11]; //! destination of the precomputed lookuptable std::string tfile; //! configuration file const NICE::Config *conf; public: /** simple constructor */ LocalFeatureColorWeijer ( const NICE::Config *c ); /** simple destructor */ virtual ~LocalFeatureColorWeijer(); /** * get the size of the descriptor * @return size of descriptor */ int getDescSize () const; /** * get the colorWeijer features * @param img grayvalue input image * @param features features (output) * @param positions position of the features * @return */ int getDescriptors ( const NICE::Image & img, NICE::VVector & positions, NICE::VVector & features ) const; /** * get the colorWeijer features * @param img color input image * @param features features (output) * @param positions given positions of the features * @return */ int getDescriptors ( const NICE::ColorImage & img, NICE::VVector & positions, NICE::VVector & features ) const; /** * visualize the features * @param mark * @param positions * @param color */ void visualizeFeatures ( NICE::Image & mark, const NICE::VVector & positions, size_t color ) const; /** * visualize the features * @param mark * @param positions * @param color */ void visualizeFeatures ( NICE::ColorImage & mark, const NICE::VVector & features, const NICE::VVector & position ) const; /** * visualize the features * @param cimg */ void visualizeFeatures ( const NICE::ColorImage & cimg ) const; /** * visualize the features * @param cimg * @param out */ void visualizeFeatures ( const NICE::ColorImage & cimg, NICE::ColorImage & out ) const; /** * load parameters */ void restore(); /** * finds a colorname in a given string * @param fn input string * @return number of the color */ int findColor ( std::string &fn ); /** * transform each pixel of an image * @param img input image * @param feats feature vector for each pixel */ void getFeats ( const NICE::ColorImage &img, NICE::MultiChannelImageT &feats ); }; } // namespace #endif