LFPatches.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. std::auto_ptr<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. public:
  37. /** simple constructor */
  38. LFPatches(const NICE::Config *conf, int numPatches);
  39. /** simple destructor */
  40. virtual ~LFPatches();
  41. int getDescSize() const;
  42. int extractFeatures(const NICE::Image & img, NICE::VVector & features,
  43. NICE::VVector & positions) const;
  44. void correctPositions(const ImagePyramid & imp, NICE::VVector & positions,
  45. NICE::VVector & positions_corrected) const;
  46. void visualize(NICE::Image & img, const NICE::Vector & feature) const;
  47. void visualizeFeatures(NICE::Image & mark, const NICE::VVector & positions,
  48. size_t color) const;
  49. //DIRTY for bofCreationSingleImage
  50. int calcDescriptor(const ImagePyramid & imp, const NICE::Vector & position,
  51. NICE::Vector & desc) const;
  52. ///////////////////// INTERFACE PERSISTENT /////////////////////
  53. // interface specific methods for store and restore
  54. ///////////////////// INTERFACE PERSISTENT /////////////////////
  55. /**
  56. * @brief Load object from external file (stream)
  57. * @author Alexander Freytag
  58. * @date 10-02-2014 ( dd-mmyyyy)
  59. */
  60. virtual void restore ( std::istream & is, int format = 0 );
  61. /**
  62. * @brief Save object to external file (stream)
  63. * @author Alexander Freytag
  64. * @date 10-02-2014 ( dd-mmyyyy)
  65. */
  66. virtual void store( std::ostream & os, int format = 0 ) const;
  67. /**
  68. * @brief Clear object
  69. * @author Alexander Freytag
  70. * @date 10-02-2014 ( dd-mmyyyy)
  71. */
  72. virtual void clear ();
  73. };
  74. } // namespace
  75. #endif