/** 
* @file LocalFeatureLFInterface.h
* @brief Interface to use a LocalFeature (Descriptor only) with routines of LocalFeatureRepresentations (Detector + Descriptor)
* @author Björn Fröhlich, Alexander Freytag
* @date 09/07/2010

*/
#ifndef LocalFeatureLFInterfaceINCLUDE
#define LocalFeatureLFInterfaceINCLUDE

// 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 "LocalFeature.h"
#include "LocalFeatureRepresentation.h"


namespace OBJREC {


/** @class LocalFeatureLFInterface
* @brief Interface to use a LocalFeature (Descriptor only) with routines of LocalFeatureRepresentations (Detector + Descriptor)
*
*/  
class LocalFeatureLFInterface : public LocalFeature
{

    protected:
    LocalFeatureRepresentation *lfpres;

    public:

        
    ///////////////////// ///////////////////// /////////////////////
    //                   CONSTRUCTORS / DESTRUCTORS
    ///////////////////// ///////////////////// /////////////////////   
    
    /** 
     * @brief default constructor 
     * @author Alexander Freytag
     * @date 06-02-2014 ( dd-mm-yyyy )
     */
    LocalFeatureLFInterface ( );
    
    /** 
     * @brief recommended constructor, calls initFromConfig
     * @author Alexander Freytag
     * @date 06-02-2014 ( dd-mm-yyyy )
     */
    LocalFeatureLFInterface ( const NICE::Config * _conf, LocalFeatureRepresentation *_lfpres );

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

    ///////////////////// ///////////////////// /////////////////////
    //                      FEATURE STUFF
    ///////////////////// ///////////////////// //////////////////        
    
    /**
    * @brief returns the size of each the SIFT-Feature
    */
    int getDescSize() const { return lfpres->getDescSize(); };
    
    /** 
    * @brief get the descriptor
    * @param img input image
    * @param positions positions for local features
    * @param descriptors output
    * @return 0
    */
    int getDescriptors ( const NICE::Image & img, NICE::VVector & positions, NICE::VVector & descriptors ) const;
    
    /** 
    * @brief get the descriptor
    * @param img input color image
    * @param positions positions for the SIFT features
    * @param descriptors output
    * @return 0
    */
    int getDescriptors ( const NICE::ColorImage & img, NICE::VVector & positions, NICE::VVector & descriptors) 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
