LFCache.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /**
  2. * @file LFCache.h
  3. * @brief read and write cache for local features
  4. * @author Björn Fröhlich
  5. * @date 02/18/2010
  6. */
  7. #ifndef LFCacheINCLUDE
  8. #define LFCacheINCLUDE
  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 "LocalFeature.h"
  14. namespace OBJREC {
  15. class LFCache : public LocalFeature
  16. {
  17. protected:
  18. //! local feature
  19. LocalFeature *lf;
  20. //! read/write from cachedir
  21. std::string cachedir;
  22. //! writing format
  23. int descFormat;
  24. int cachemode;
  25. template <class ImageClass>
  26. int getDescriptorsTemplate ( const ImageClass & img, NICE::VVector & positions, NICE::VVector & descriptors ) const;
  27. public:
  28. /** simple constructor */
  29. LFCache ( const NICE::Config *conf, LocalFeature *_lf );
  30. /** simple destructor */
  31. virtual ~LFCache();
  32. /**
  33. * returns the size of local feature
  34. * @return size
  35. */
  36. int getDescSize() const { return lf->getDescSize(); };
  37. /**
  38. * get the descriptor
  39. * @param img input image
  40. * @param positions positions
  41. * @param descriptors output
  42. * @return 0
  43. */
  44. int getDescriptors ( const NICE::Image & img, NICE::VVector & positions, NICE::VVector & descriptors ) const;
  45. /**
  46. * get the descriptor
  47. * @param cimg input color image
  48. * @param positions positions
  49. * @param descriptors output
  50. * @return 0
  51. */
  52. int getDescriptors ( const NICE::ColorImage & cimg, NICE::VVector & positions, NICE::VVector & descriptors ) const;
  53. void visualizeFeatures ( NICE::Image & mark,
  54. const NICE::VVector & positions,
  55. size_t color ) const;
  56. };
  57. } // namespace
  58. #include "LFCache.tcc"
  59. #endif