#ifndef __FEATURESIFT__
#define __FEATURESIFT__

#include "image2d.h"
#include <vector>

/// SIFT implementation
class featuresift
{
 public:
  featuresift();
  ~featuresift();

  int clear();

  int init(  image2d *mag, image2d *ori, int lx, int ly, int sz);

  double match( featuresift &sift );

  int posx() const
  {
    return cx;
  }
  int posy() const
  {
    return cy;
  }
  int size() const
  {
    return sz;
  }
 private:

  int calc_gradhist( double *v,
                     int lx, int ly, 
                     int sz, 
                     image2d *mag,
                     image2d *ori );

  int normalize();
  /**
   * room for 4 by 4 by 8 gradiant vector
   */
  double feature[128];
  /// normalized feature vector
  double nfeature[128];

  int sz;
  int cx;
  int cy;
};

#endif
