/** 
* @file LFSiftPP.h
* @brief Sift++ interface (with detector!)
* @author Erik Rodner, Alexander Freytag
* @date 11/19/2007

*/
#ifndef LFSIFTPPINCLUDE
#define LFSIFTPPINCLUDE

// nice-core includes
#include <core/basics/Config.h>
//
#include <core/image/ImageT.h>
// 
#include <core/imagedisplay/ImageDisplay.h>
// 
#include <core/vector/VectorT.h>
#include <core/vector/MatrixT.h>

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


namespace OBJREC {

/** Sift++ interface */
class LFSiftPP : public LocalFeatureRepresentation
{

  protected:
      
    /////////////////////////
    /////////////////////////
    // PROTECTED VARIABLES //
    /////////////////////////
    /////////////////////////         
      enum DESCRIPTORALIGNMENT{
          DALGIN_DETECTOR = 0,
          DALIGN_MULTIPLE
      };

      DESCRIPTORALIGNMENT descriptorAlignment;
      
      double minScale;
      
      double maxScale;
      
      int numScales;
      
      int numAngles;

      
      float threshold;
      
      float edgeThreshold;
      
      int levels;
      
      int octaves;
      
      int first_octave;
      
      bool normalizeFeature;

  public:
    
    ///////////////////// ///////////////////// /////////////////////
    //                   CONSTRUCTORS / DESTRUCTORS
    ///////////////////// ///////////////////// /////////////////////
    
    /** 
     * @brief default constructor
     * @date 10-02-2014 (dd-mm-yyyy )
     * @author Alexander Freytag
     */
    LFSiftPP ( );     

    /** 
     * @brief simple constructor 
     */
    LFSiftPP( const NICE::Config *conf );
  
    /** 
     * @brief simple destructor 
     */
    virtual ~LFSiftPP();
      
    /** 
     * @brief Jobs previously performed in the config-version of the constructor, read settings etc.
     * @author Alexander Freytag
     * @date 10-02-2014 ( dd-mm-yyyy )
     */    
    void initFromConfig ( const NICE::Config * _conf, const std::string & _confSection = "LFSiftPP");       
      
    ///////////////////// ///////////////////// /////////////////////
    //                      FEATURE STUFF
    ///////////////////// ///////////////////// //////////////////       
      
    int getDescSize () const;

    int extractFeatures ( const NICE::Image & img, NICE::VVector & features, 
                          NICE::VVector & positions ) const;

    void visualizeFeatures ( NICE::Image & mark,
                              const NICE::VVector & positions,
                              size_t color ) const;
                                
    ///////////////////// INTERFACE PERSISTENT /////////////////////
    // interface specific methods for store and restore
    ///////////////////// INTERFACE PERSISTENT /////////////////////   
    
    /** 
     * @brief Load object from external file (stream)
     * @author Alexander Freytag
     * @date 09-02-2014 ( dd-mmyyyy)
     */     
    virtual void restore ( std::istream & is, int format = 0 );
    
    /** 
     * @brief Save object to external file (stream)
     * @author Alexander Freytag
     * @date 09-02-2014 ( dd-mmyyyy)
     */       
    virtual void store( std::ostream & os, int format = 0 ) const;
    
    /** 
     * @brief Clear  object
     * @author Alexander Freytag
     * @date 09-02-2014 ( dd-mmyyyy)
     */    
    virtual void clear ();                                 
  
};


} // namespace

#endif
