LocalFeatureCentrist.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /**
  2. * @file LocalFeatureCentrist.h
  3. * @brief Implementation of the LocalFeatureCentrist feature published in "CENTRIST: A Visual Descriptor for Scene Categorization" (PAMI 2011)
  4. * @author Alexander Freytag
  5. * @date 12/06/2011
  6. * @NOTE NEEDS PROPER UNIT TEST!
  7. */
  8. #ifndef CENTRISTINCLUDE
  9. #define CENTRISTINCLUDE
  10. #include <core/basics/Config.h>
  11. //
  12. #include <core/image/ImageT.h>
  13. //
  14. #include <core/vector/MatrixT.h>
  15. #include <core/vector/VectorT.h>
  16. #include <core/vector/VVector.h>
  17. // nice-vislearning includes
  18. #include "LocalFeature.h"
  19. namespace OBJREC {
  20. /** interface to CENTRIST implementation*/
  21. class LocalFeatureCentrist : public LocalFeature
  22. {
  23. protected:
  24. int i_sizeNeighborhood;
  25. int CensusTransform(const NICE::Image & img, const int & x, const int & y) const;
  26. int CensusTransform(const NICE::ColorImage & img, const int & x, const int & y, const int & channel) const;
  27. void GenerateHistForOneRect(const NICE::Image & img, const int & xi, const int & xa, const int & yi, const int & ya, NICE::Vector & feature) const;
  28. void GenerateHistForOneRect(const NICE::ColorImage & img, const int & xi, const int & xa, const int & yi, const int & ya, NICE::Vector & feature) const;
  29. void computeDesc( const NICE::Image & img, NICE::VVector & positions, NICE::VVector & descriptors ) const;
  30. void computeDesc( const NICE::ColorImage & img, NICE::VVector & positions, NICE::VVector & descriptors ) const;
  31. public:
  32. /** simple constructor */
  33. LocalFeatureCentrist();
  34. /** default constructor */
  35. LocalFeatureCentrist(const NICE::Config *conf, const std::string & section="CENTRIST");
  36. /** simple destructor */
  37. virtual ~LocalFeatureCentrist();
  38. /** Beware: multiply this number by the number of channels you use in your color image*/
  39. virtual int getDescSize() const;
  40. virtual int getDescriptors ( const NICE::Image & img, NICE::VVector & positions, NICE::VVector & descriptors) const;
  41. virtual int getDescriptors ( const NICE::ColorImage & img, NICE::VVector & positions, NICE::VVector & descriptors) const;
  42. virtual void visualizeFeatures ( NICE::Image & mark,
  43. const NICE::VVector & positions,
  44. size_t color ) const;
  45. };
  46. } // namespace
  47. #endif