LFWriteCache.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /**
  2. * @file LFWriteCache.h
  3. * @brief Write local features to file (whenever a descriptor is computed, it will be checked whether a corresponding file already exists. If not, we save the descriptor)
  4. * @author Erik Rodner, Alexander Freytag
  5. * @date 02/14/2008
  6. */
  7. #ifndef LFWriteCacheINCLUDE
  8. #define LFWriteCacheINCLUDE
  9. #include "core/vector/VectorT.h"
  10. #include "core/vector/MatrixT.h"
  11. #include "core/image/ImageT.h"
  12. #include "LocalFeatureRepresentation.h"
  13. #include "core/basics/Config.h"
  14. namespace OBJREC {
  15. /** @class LFWriteCache
  16. * @brief Write local features to file (whenever a descriptor is computed, it will be checked whether a corresponding file already exists. If not, we save the descriptor)
  17. *
  18. */
  19. class LFWriteCache : public LocalFeatureRepresentation
  20. {
  21. protected:
  22. const LocalFeatureRepresentation *lfrep;
  23. std::string cachedir;
  24. int descFormat;
  25. int cachemode;
  26. public:
  27. /** simple constructor */
  28. LFWriteCache( const NICE::Config *conf,
  29. const LocalFeatureRepresentation *lfrep,
  30. const std::string & _section = "cache"
  31. );
  32. /** simple destructor */
  33. virtual ~LFWriteCache();
  34. int getDescSize () const;
  35. /**
  36. * extract features for gray images
  37. * @param img input image
  38. * @param features output features
  39. * @param positions position of the features
  40. * @return
  41. */
  42. int extractFeatures ( const NICE::Image & img,
  43. NICE::VVector & features,
  44. NICE::VVector & positions ) const;
  45. /**
  46. * extract features for color images
  47. * @param img input image
  48. * @param features output features
  49. * @param positions position of the features
  50. * @return
  51. */
  52. int extractFeatures ( const NICE::ColorImage & img,
  53. NICE::VVector & features,
  54. NICE::VVector & positions ) const;
  55. void visualize ( NICE::Image & img,
  56. const NICE::Vector & feature ) const;
  57. void visualizeFeatures ( NICE::Image & mark,
  58. const NICE::VVector & positions,
  59. size_t color ) const;
  60. };
  61. } // namespace
  62. #endif