/**
* @file LFColorSande.h
* @brief interface to ColorSande implementation
* @author Erik Rodner, Alexander Freytag
* @date 11/19/2007

*/
#ifndef LFColorSandeINCLUDE
#define LFColorSandeINCLUDE

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

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



namespace OBJREC {

/** interface to ColorSande implementation */
class LFColorSande : public LocalFeatureRepresentation
{

  protected:
    
    /////////////////////////
    /////////////////////////
    // PROTECTED VARIABLES //
    /////////////////////////
    /////////////////////////    
    
    std::string c_binaryExecutable;

    std::string c_params;

    //! used scales
    std::string scales;

    //! size of the descriptor
    int descriptor_size;

    //! use grid for SIFT Positions
    bool usegrid;

    //! size of the grid
    std::string gridsize;


//     double c_minScale;

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

    /** 
     * @brief simple constructor 
     */
    LFColorSande ( const NICE::Config * _conf, std::string _confSection = "LFColorSande" );

    /** simple destructor */
    virtual ~LFColorSande();
    
    /** 
     * @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 = "LFColorSande");     
    
    ///////////////////// ///////////////////// /////////////////////
    //                      FEATURE STUFF
    ///////////////////// ///////////////////// //////////////////            

    int getDescSize () const;

    /**
     * get the colorSIFT features
     * @param img grayvalue input image
     * @param features features (output)
     * @param positions position of the features
     * @return
     */
    int extractFeatures ( const NICE::Image & img, NICE::VVector & features,
                          NICE::VVector & positions ) const;

    /**
     * get the colorSIFT features
     * @param img color input image
     * @param features features (output)
     * @param positions position of the features
     * @return
     */
    int extractFeatures ( const NICE::ColorImage & img, NICE::VVector & features,
                          NICE::VVector & positions ) const;
                          
    ///////////////////// INTERFACE PERSISTENT /////////////////////
    // interface specific methods for store and restore
    ///////////////////// INTERFACE PERSISTENT /////////////////////   
    
    /** 
     * @brief Load object from external file (stream)
     * @author Alexander Freytag
     * @date 10-02-2014 ( dd-mmyyyy)
     */     
    virtual void restore ( std::istream & is, int format = 0 );
    
    /** 
     * @brief Save object to external file (stream)
     * @author Alexander Freytag
     * @date 10-02-2014 ( dd-mmyyyy)
     */       
    virtual void store( std::ostream & os, int format = 0 ) const;
    
    /** 
     * @brief Clear  object
     * @author Alexander Freytag
     * @date 10-02-2014 ( dd-mmyyyy)
     */    
    virtual void clear ();                            

};


} // namespace

#endif
