/**
* @file HaarFeature.h
* @brief simple haar like feature
* @author Erik Rodner
* @date 04/21/2008

*/
#ifndef HAARFEATUREINCLUDE
#define HAARFEATUREINCLUDE

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

#include "core/basics/Config.h"

#include "vislearning/cbaselib/Feature.h"


namespace OBJREC {

/** simple haar like feature */
class HaarFeature : public Feature
{

  protected:
    enum {
      HAARTYPE_HORIZONTAL = 0,
      HAARTYPE_VERTICAL,
      HAARTYPE_DIAGONAL,
      HAARTYPE_3BLOCKS,
      HAARTYPE_NUMTYPES
    };

    int type;
    int pos1;
    int pos2;
    int step_x;
    int step_y;
    int window_size_x;
    int window_size_y;

  public:

    /** simple constructor */
    HaarFeature ( const NICE::Config *conf );

    /** without memory wasting config */
    HaarFeature ( int window_size_x,
                  int window_size_y,
                  int step_x,
                  int step_y );

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

    virtual double val ( const Example *example ) const;

    void explode ( FeaturePool & featurePool, bool variableWindow ) const;
    Feature *clone() const;

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

};


} // namespace

#endif
