Featuretype.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /**
  2. * @file FeatureType.h
  3. * @brief dynamic selection between SparseVector and Vector
  4. * @author Björn Fröhlich
  5. * @date 02/08/2010
  6. */
  7. #ifndef FeatureTypeINCLUDE
  8. #define FeatureTypeINCLUDE
  9. #include "core/vector/SparseVectorT.h"
  10. #include "core/basics/Persistent.h"
  11. namespace OBJREC {
  12. //! enumeration for feature types
  13. enum Featuretype
  14. {
  15. VECTORFEATURE,
  16. SPARSEVECTORFEATURE
  17. };
  18. //! a class to differ between Vector und Sparsevector features
  19. class FeatureType
  20. {
  21. protected:
  22. //! Sparse or Vectorfeature?
  23. int ft;
  24. //! save to sv if Sparsefeatures
  25. NICE::SparseVector sv;
  26. //! save to v if vectorfeature
  27. NICE::Vector v;
  28. public:
  29. /**
  30. * constructor
  31. * @param f type of the faeture
  32. * @param dim dimension of the new feature
  33. */
  34. FeatureType(int f, int dim);
  35. /**
  36. * constructor setting SparseFeature
  37. * @param tsv input SparseFeature
  38. */
  39. FeatureType(NICE::SparseVector &tsv);
  40. /**
  41. * constructor setting VectorFeature
  42. * @param tv input VectorFeature
  43. */
  44. FeatureType(NICE::Vector &tv);
  45. /**
  46. * copy constructor
  47. * @param _ft
  48. */
  49. FeatureType(const FeatureType &_ft);
  50. void setDim(int dim);
  51. /**
  52. * get the dimension of feature
  53. * @return dimension of feature
  54. */
  55. int getDim() const;
  56. /**
  57. * returns adress of Vector
  58. * @return
  59. */
  60. const NICE::Vector& getVec() const;
  61. /**
  62. * returns adress of SparseVector
  63. * @return
  64. */
  65. const NICE::SparseVector& getSVec() const;
  66. double get(int pos) const;
  67. int getType();
  68. };
  69. } // namespace
  70. #endif