/**
* @file PixelPairFeature.h
* @brief like in Shotton paper
* @author Erik Rodner
* @date 04/21/2008

*/
#ifndef PixelPairFeatureINCLUDE
#define PixelPairFeatureINCLUDE

#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 PixelPairFeature : public Feature
{

  protected:
    enum {
      PPTYPE_DIFF = 0,
      PPTYPE_ABSDIFF,
      PPTYPE_SUM,
      PPTYPE_VALUE
    };

    int type;
    int imagetype;

    int x1;
    int y1;
    int b1;

    int x2;
    int y2;
    int b2;

    int step_x;
    int step_y;

    int window_size_x;
    int window_size_y;

  public:

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

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

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

    double val ( const Example *example ) const;

    void explode ( FeaturePool & featurePool, bool variableWindow = true ) const;

    Feature *clone() const;

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

#if 0
    void calcFeatureValues ( const Examples & examples,
                             std::vector<int> & examples_selection,
                             FeatureValuesUnsorted & values ) const;
#endif

};


} // namespace

#endif
