Centrist.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /**
  2. * @file Centrist.h
  3. * @brief Implementation of the Centrist feature published in "CENTRIST: A Visual Descriptor for Scene Categorization" (PAMI 2011)
  4. * @author Alexander Lütz
  5. * @date 12/06/2011
  6. */
  7. #ifndef CENTRISTINCLUDE
  8. #define CENTRISTINCLUDE
  9. #ifdef NOVISUAL
  10. #include <vislearning/nice_nonvis.h>
  11. #else
  12. #include <vislearning/nice.h>
  13. #endif
  14. #include "core/vector/VVector.h"
  15. #include "LocalFeature.h"
  16. #include "core/basics/Config.h"
  17. namespace OBJREC {
  18. /** interface to CENTRIST implementation*/
  19. class Centrist : public LocalFeature
  20. {
  21. protected:
  22. int sizeNeighborhood;
  23. int CensusTransform(const NICE::Image & img, const int & x, const int & y);
  24. int CensusTransform(const NICE::ColorImage & img, const int & x, const int & y, const int & channel);
  25. void GenerateHistForOneRect(const NICE::Image & img, const int & xi, const int & xa, const int & yi, const int & ya, NICE::Vector & feature);
  26. void GenerateHistForOneRect(const NICE::ColorImage & img, const int & xi, const int & xa, const int & yi, const int & ya, NICE::Vector & feature);
  27. void computeDesc( const NICE::Image & img, NICE::VVector & positions, NICE::VVector & descriptors );
  28. void computeDesc( const NICE::ColorImage & img, NICE::VVector & positions, NICE::VVector & descriptors );
  29. public:
  30. /** simple constructor */
  31. Centrist();
  32. /** default constructor */
  33. Centrist(const NICE::Config *conf, const std::string & section="CENTRIST");
  34. /** simple destructor */
  35. virtual ~Centrist();
  36. // we have 8 neighbors, so the size is always 256 with the given implementation (without spatial levels, ...)
  37. /** Beware: multiply this number by the number of channels you use in your color image*/
  38. int getDescSize(){return 256;};
  39. int getDescriptors ( const NICE::Image & img, NICE::VVector & positions, NICE::VVector & descriptors);
  40. int getDescriptors ( const NICE::ColorImage & img, NICE::VVector & positions, NICE::VVector & descriptors);
  41. void visualizeFeatures ( NICE::Image & mark,
  42. const NICE::VVector & positions,
  43. size_t color ) const;
  44. };
  45. } // namespace
  46. #endif