/** 
* @file LocalFeatureCentrist.h
* @brief Implementation of the LocalFeatureCentrist feature published in  "CENTRIST: A Visual Descriptor for Scene Categorization" (PAMI 2011)
* @author Alexander Freytag
* @date 12/06/2011
* @NOTE NEEDS PROPER UNIT TEST!
*/
#ifndef CENTRISTINCLUDE
#define CENTRISTINCLUDE

#include <core/basics/Config.h>
// 
#include <core/image/ImageT.h>
// 
#include <core/vector/MatrixT.h>
#include <core/vector/VectorT.h>
#include <core/vector/VVector.h>

// nice-vislearning includes
#include "LocalFeature.h"

  

namespace OBJREC {

/** interface to CENTRIST implementation*/
class LocalFeatureCentrist : public LocalFeature
{

    protected:
      int i_sizeNeighborhood;
      
      int CensusTransform(const NICE::Image & img, const int & x, const int & y) const;
      int CensusTransform(const NICE::ColorImage & img, const int & x, const int & y, const int & channel) const;
      
      void GenerateHistForOneRect(const NICE::Image & img, const int & xi, const int & xa, const int & yi, const int & ya, NICE::Vector & feature) const;
      void GenerateHistForOneRect(const NICE::ColorImage & img, const int & xi, const int & xa, const int & yi, const int & ya, NICE::Vector & feature) const;
      
      void computeDesc( const NICE::Image & img, NICE::VVector & positions, NICE::VVector & descriptors ) const;
      void computeDesc( const NICE::ColorImage & img, NICE::VVector & positions, NICE::VVector & descriptors )  const;

    public:
  
      /** simple constructor */
      LocalFeatureCentrist();
      /** default constructor */
      LocalFeatureCentrist(const NICE::Config *conf, const std::string & section="CENTRIST");
          
      /** simple destructor */
      virtual ~LocalFeatureCentrist();

      /** Beware: multiply this number by the number of channels you use in your color image*/
      virtual int getDescSize() const;

      virtual int getDescriptors ( const NICE::Image & img, NICE::VVector & positions, NICE::VVector & descriptors) const;
      
      virtual int getDescriptors ( const NICE::ColorImage & img, NICE::VVector & positions, NICE::VVector & descriptors) const;
      
      virtual void visualizeFeatures ( NICE::Image & mark,
            const NICE::VVector & positions,
            size_t color ) const;
    
};


} // namespace

#endif
