Centrist.h~ 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 "vislearning/math/mathbase/VVector.h"
  15. #include "LocalFeature.h"
  16. #include "vislearning/baselib/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, OBJREC::VVector & positions, OBJREC::VVector & descriptors );
  28. void computeDesc( const NICE::ColorImage & img, OBJREC::VVector & positions, OBJREC::VVector & descriptors );
  29. public:
  30. /** simple constructor */
  31. Centrist();
  32. /** default constructor */
  33. Centrist(const 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. int getDescSize(){return 256;};
  38. int getDescriptors ( const NICE::Image & img, OBJREC::VVector & positions, OBJREC::VVector & descriptors);
  39. int getDescriptors ( const NICE::ColorImage & img, OBJREC::VVector & positions, OBJREC::VVector & descriptors);
  40. void visualizeFeatures ( NICE::Image & mark,
  41. const VVector & positions,
  42. size_t color ) const;
  43. };
  44. } // namespace
  45. #endif