LFCache.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 <vislearning/nice.h>
  10. #include "core/basics/Config.h"
  11. #include "LocalFeature.h"
  12. namespace OBJREC {
  13. class LFCache : public LocalFeature
  14. {
  15. protected:
  16. //! local feature
  17. LocalFeature *lf;
  18. //! read/write from cachedir
  19. std::string cachedir;
  20. //! writing format
  21. int descFormat;
  22. int cachemode;
  23. template <class ImageClass>
  24. int getDescriptorsTemplate ( const ImageClass & img, NICE::VVector & positions, NICE::VVector & descriptors ) const;
  25. public:
  26. /** simple constructor */
  27. LFCache ( const NICE::Config *conf, LocalFeature *_lf );
  28. /** simple destructor */
  29. virtual ~LFCache();
  30. /**
  31. * returns the size of local feature
  32. * @return size
  33. */
  34. int getDescSize() const { return lf->getDescSize(); };
  35. /**
  36. * get the descriptor
  37. * @param img input image
  38. * @param positions positions
  39. * @param descriptors output
  40. * @return 0
  41. */
  42. int getDescriptors ( const NICE::Image & img, NICE::VVector & positions, NICE::VVector & descriptors ) const;
  43. /**
  44. * get the descriptor
  45. * @param cimg input color image
  46. * @param positions positions
  47. * @param descriptors output
  48. * @return 0
  49. */
  50. int getDescriptors ( const NICE::ColorImage & cimg, NICE::VVector & positions, NICE::VVector & descriptors ) const;
  51. void visualizeFeatures ( NICE::Image & mark,
  52. const NICE::VVector & positions,
  53. size_t color ) const;
  54. };
  55. } // namespace
  56. #include "LFCache.tcc"
  57. #endif