123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- /**
- * @file SparseVectorFeature.h
- * @brief feature class to use in Examples stored sparse features
- * @author Björn Fröhlich
- * @date 05/25/2009
- */
- #ifndef SparseVectorFeatureINCLUDE
- #define SparseVectorFeatureINCLUDE
- #include "core/vector/VectorT.h"
- #include "core/vector/MatrixT.h"
- #include "core/image/ImageT.h"
- #include "core/imagedisplay/ImageDisplay.h"
-
- #include "core/basics/Config.h"
- #include "vislearning/cbaselib/Feature.h"
- #include "core/vector/SparseVectorT.h"
- namespace OBJREC {
- class SparseVectorFeature : public Feature
- {
- protected:
- //! feature dimension
- int dimension;
-
- //! index of the feature
- int feature_index;
- public:
-
- /**
- * internally used by SparseVectorFeature::explode
- * @param _dimension new dimension
- * @param _feature_index new featureindex
- */
- SparseVectorFeature ( int _dimension, int _feature_index = 0 ) { dimension = _dimension; feature_index = _feature_index; };
-
- /**
- * simple destructor
- */
- virtual ~SparseVectorFeature();
-
- /**
- * returns the value of the sparse feature stored in example
- * @param example input example
- * @return feature value
- */
- double val( const Example *example ) const;
-
-
- /**
- * creates for each feature a own SparseVectorFeature in featurepool
- * @param featurePool the feature pool
- * @param variableWindow
- */
- void explode ( FeaturePool & featurePool, bool variableWindow = true ) const;
-
-
- Feature *clone() const;
- Feature *generateFirstParameter () const;
- /**
- * store the data
- * @param is input stream
- * @param format
- */
- void restore (std::istream & is, int format = 0);
-
-
- /**
- * read the data
- * @param os
- * @param format
- */
- void store (std::ostream & os, int format = 0) const;
-
-
- /**
- * does nothing
- */
- void clear ();
-
- /**
- * returns the feature index and the dimension
- * @param feature_index
- * @param dimension
- */
- void getStump ( int & feature_index, int & dimension ) const;
- };
- } // namespace
- #endif
|