/**
* @file HistFeature.h
* @brief histogram integral feature
* @author Erik Rodner
* @date 05/07/2008

*/
#ifndef HistFeatureINCLUDE
#define HistFeatureINCLUDE

#include "core/vector/VectorT.h"
#include "core/vector/MatrixT.h"

#include "core/basics/Config.h"
#include "vislearning/cbaselib/Feature.h"


namespace OBJREC {

/** histogram integral feature */
class HistFeature : public Feature
{

  protected:

    enum {
      HISTFEATURE_NORMMETHOD_L1 = 0,
      HISTFEATURE_NORMMETHOD_L2
    };

    /** @{ feature parameter */
    int window_size_x;
    int window_size_y;

    int histtype;
    int bin;
    int cellx1;
    int celly1;
    int cellx2;
    int celly2;
    int cellcountx;
    int cellcounty;
    int normalizationMethod;

    bool flexibleGrid;

    /** @} */

    /** @{ parameter for feature generation */
    int numScales;
    int numBins;
    double scaleStep;
    /** @} */

  public:

    /** simple constructor */
    HistFeature ( const NICE::Config *conf,
                  const std::string & section,
                  int _histtype,
                  int _numBins );

    /** internally used by HistFeature::explode */
    HistFeature () {};

    /** simple destructor */
    virtual ~HistFeature();

    double val ( const Example *example ) const;
    void explode ( FeaturePool & featurePool, bool variableWindow = true ) const;
    Feature *clone() const;
    Feature *generateFirstParameter () const;

    void restore ( std::istream & is, int format = 0 );
    void store ( std::ostream & os, int format = 0 ) const;
    void clear ();
};

} // namespace

#endif
