LFPatches.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /**
  2. * @file LFPatches.h
  3. * @brief simple patch based approach
  4. * @author Erik Rodner
  5. * @date 02/06/2008
  6. */
  7. #ifndef LFPATCHESINCLUDE
  8. #define LFPATCHESINCLUDE
  9. #include "core/vector/VectorT.h"
  10. #include "core/vector/MatrixT.h"
  11. #include "core/image/ImageT.h"
  12. #include "core/basics/Config.h"
  13. #include "vislearning/image/ImagePyramid.h"
  14. #include "LocalFeatureRepresentation.h"
  15. #include "vislearning/features/localfeatures/InterestDetector.h"
  16. namespace OBJREC
  17. {
  18. /** simple patch based approach */
  19. class LFPatches: public LocalFeatureRepresentation
  20. {
  21. protected:
  22. enum
  23. {
  24. NORMALIZE_N01 = 0, NORMALIZE_NONE, NORMALIZE_STDDEV, NORMALIZE_MEAN
  25. };
  26. int xsize;
  27. int ysize;
  28. int normalization;
  29. InterestDetector * id;
  30. int maxLevels;
  31. double scaleSpacing;
  32. int detectormode;
  33. int numPatches;
  34. void calcDescriptors(const ImagePyramid & imp, NICE::VVector & positions,
  35. NICE::VVector & features) const;
  36. void setDetector ( const int & _detectormode, const NICE::Config * conf);
  37. void setNormalization( const std::string & _normalization_s) ;
  38. public:
  39. ///////////////////// ///////////////////// /////////////////////
  40. // CONSTRUCTORS / DESTRUCTORS
  41. ///////////////////// ///////////////////// /////////////////////
  42. /**
  43. * @brief default constructor
  44. * @date 10-02-2014 (dd-mm-yyyy )
  45. * @author Alexander Freytag
  46. */
  47. LFPatches();
  48. /** simple constructor */
  49. LFPatches(const NICE::Config *conf, int numPatches);
  50. /** simple destructor */
  51. virtual ~LFPatches();
  52. ///////////////////// ///////////////////// /////////////////////
  53. // FEATURE STUFF
  54. ///////////////////// ///////////////////// //////////////////
  55. int getDescSize() const;
  56. int extractFeatures(const NICE::Image & img, NICE::VVector & features,
  57. NICE::VVector & positions) const;
  58. void correctPositions(const ImagePyramid & imp, NICE::VVector & positions,
  59. NICE::VVector & positions_corrected) const;
  60. void visualize(NICE::Image & img, const NICE::Vector & feature) const;
  61. void visualizeFeatures(NICE::Image & mark, const NICE::VVector & positions,
  62. size_t color) const;
  63. //DIRTY for bofCreationSingleImage
  64. int calcDescriptor(const ImagePyramid & imp, const NICE::Vector & position,
  65. NICE::Vector & desc) const;
  66. ///////////////////// INTERFACE PERSISTENT /////////////////////
  67. // interface specific methods for store and restore
  68. ///////////////////// INTERFACE PERSISTENT /////////////////////
  69. /**
  70. * @brief Load object from external file (stream)
  71. * @author Alexander Freytag
  72. * @date 10-02-2014 ( dd-mmyyyy)
  73. */
  74. virtual void restore ( std::istream & is, int format = 0 );
  75. /**
  76. * @brief Save object to external file (stream)
  77. * @author Alexander Freytag
  78. * @date 10-02-2014 ( dd-mmyyyy)
  79. */
  80. virtual void store( std::ostream & os, int format = 0 ) const;
  81. /**
  82. * @brief Clear object
  83. * @author Alexander Freytag
  84. * @date 10-02-2014 ( dd-mmyyyy)
  85. */
  86. virtual void clear ();
  87. };
  88. } // namespace
  89. #endif