Centrist.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. #include "core/vector/VectorT.h"
  10. #include "core/vector/MatrixT.h"
  11. #include "core/image/ImageT.h"
  12. #include "core/vector/VVector.h"
  13. #include "LocalFeature.h"
  14. #include "core/basics/Config.h"
  15. namespace OBJREC {
  16. /** interface to CENTRIST implementation*/
  17. class Centrist : public LocalFeature
  18. {
  19. protected:
  20. int sizeNeighborhood;
  21. int CensusTransform(const NICE::Image & img, const int & x, const int & y);
  22. int CensusTransform(const NICE::ColorImage & img, const int & x, const int & y, const int & channel);
  23. void GenerateHistForOneRect(const NICE::Image & img, const int & xi, const int & xa, const int & yi, const int & ya, NICE::Vector & feature);
  24. void GenerateHistForOneRect(const NICE::ColorImage & img, const int & xi, const int & xa, const int & yi, const int & ya, NICE::Vector & feature);
  25. void computeDesc( const NICE::Image & img, NICE::VVector & positions, NICE::VVector & descriptors );
  26. void computeDesc( const NICE::ColorImage & img, NICE::VVector & positions, NICE::VVector & descriptors );
  27. public:
  28. /** simple constructor */
  29. Centrist();
  30. /** default constructor */
  31. Centrist(const NICE::Config *conf, const std::string & section="CENTRIST");
  32. /** simple destructor */
  33. virtual ~Centrist();
  34. // we have 8 neighbors, so the size is always 256 with the given implementation (without spatial levels, ...)
  35. /** Beware: multiply this number by the number of channels you use in your color image*/
  36. int getDescSize(){return 256;};
  37. int getDescriptors ( const NICE::Image & img, NICE::VVector & positions, NICE::VVector & descriptors);
  38. int getDescriptors ( const NICE::ColorImage & img, NICE::VVector & positions, NICE::VVector & descriptors);
  39. void visualizeFeatures ( NICE::Image & mark,
  40. const NICE::VVector & positions,
  41. size_t color ) const;
  42. };
  43. } // namespace
  44. #endif