/** 
* @file FCGetFeature.cpp
* @brief interface to GetFeature
* @author Erik Rodner
* @date 10.09.2007

*/
#ifdef NICE_USELIB_ICE
#include <core/imagedisplay/ImageDisplay.h>
#include <image_nonvis.h>
#include <core/iceconversion/convertice.h>
#include <core/iceconversion/image_convertice.h>

#include <iostream>

#include "vislearning/features/simplefeatures/FCGetFeature.h"

using namespace OBJREC;

using namespace std;
using namespace NICE;

FCGetFeature::FCGetFeature( const Config *_conf, 
			    ice::GetFeature *_gf ) :
			FeatureFactory ( _conf ), 
			gf(_gf)
{
}

FCGetFeature::~FCGetFeature()
{
}

/** return feature vector for this image */
int FCGetFeature::convert ( const NICE::Image & src, NICE::Vector & vec )
{
    if ( (int)vec.size() != gf->getDimension() )
	vec.resize( gf->getDimension() );

    ice::Window win ( 0, 0, src.width()-1, src.height()-1 );
    ice::Contur c;
    c.SetStart ( win.XI(), win.YI() );
    c.Add ( win.XA(), win.YI() );
    c.Add ( win.XA(), win.YA() );
    c.Add ( win.XI(), win.YA() );
    c.Add ( win.XI(), win.YI() );

    ice::Vector vec_ice ( gf->getDimension() );
    gf->get_feature ( NICE::createIceImage ( src ) , c, vec_ice, win );
    vec = NICE::makeEVector<double> ( vec_ice );

    return 0;
}

#endif