/** * @file ConvolutionFeature.h * @brief convolutional feature * @author Sven Sickert * @date 10/13/2008 */ #ifndef ConvolutionFeatureINCLUDE #define ConvolutionFeatureINCLUDE #include "core/vector/VectorT.h" #include "core/vector/MatrixT.h" #include "core/basics/Config.h" #include "vislearning/cbaselib/Feature.h" namespace OBJREC{ /** convolutional feature */ class ConvolutionFeature : public Feature { protected: ///////////////////////// ///////////////////////// // PROTECTED VARIABLES // ///////////////////////// ///////////////////////// /** feature parameter */ int window_size_x; int window_size_y; int window_size_z; int paramsLength; int numChannels; bool isColor; bool useSpatialPriors; NICE::Vector *params; /** * @brief (re)initialize parameter vector */ void initializeParameterVector(); public: ///////////////////// ///////////////////// ///////////////////// // CONSTRUCTORS / DESTRUCTORS ///////////////////// ///////////////////// ///////////////////// /** simple constructor */ ConvolutionFeature ( ); /** alternative constructor */ ConvolutionFeature ( const int wsize_x, const int wsize_y, const bool color = false, const bool prior = false ); /** alternative 3d constructor */ ConvolutionFeature ( const int wsize_x, const int wsize_y, const int wsize_z, const bool color = false, const bool prior = false ); /** default constructor */ ConvolutionFeature ( const NICE::Config *conf ); /** copy constructor */ ConvolutionFeature ( const ConvolutionFeature *convFeat ); /** simple destructor */ virtual ~ConvolutionFeature ( ); ///////////////////// ///////////////////// ///////////////////// // FEATURE STUFF ///////////////////// ///////////////////// ///////////////////// /** * @brief return isColor variable * @return isColor */ bool isColorMode () const; /** * @brief return parameter vector * @return parameter vector */ NICE::Vector getParameterVector () const; /** * @brief return feature vector * @param example current example * @param returned feature vector */ void getFeatureVector ( const Example *example, NICE::Vector &vec ) const; /** * @brief return length of parameter vector * @return length of vector */ int getParameterLength () const; /** * @brief set parameter vector * @param vec new parameter vector */ void setParameterVector ( const NICE::Vector &vec ); /** * @brief set a random parameter vector */ void setRandomParameterVector (); /** * @brief return feature value for given example * @param example given Example * @return double feature value */ double val ( const Example *example ) const; /** * @brief create feature pool with convolutional features * @param featurePool to be filled * @param variableWindow */ void explode ( FeaturePool &featurePool, bool variableWindow = true ) const; /** * @brief clone current feature * @return clone of current feature */ Feature *clone () const; Feature *generateFirstParameter () const; ///////////////////// INTERFACE PERSISTENT ///////////////////// // interface specific methods for store and restore ///////////////////// INTERFACE PERSISTENT ///////////////////// /** * @brief Load convolution feature object from external file (stream) */ void restore ( std::istream & is, int format = 0 ); /** * @brief Save convolution feature object to external file (stream) */ void store( std::ostream & os, int format = 0 ) const; /** * @brief Clear convolution feature object */ void clear (); }; } //namespace #endif