LFReadCache.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /**
  2. * @file LFReadCache.h
  3. * @brief read local features from file
  4. * @author Erik Rodner
  5. * @date 02/14/2008
  6. */
  7. #ifndef LFReadCacheINCLUDE
  8. #define LFReadCacheINCLUDE
  9. #include "core/vector/VectorT.h"
  10. #include "core/vector/MatrixT.h"
  11. #include "core/image/ImageT.h"
  12. #include "LocalFeatureRepresentation.h"
  13. #include "LFSiftPP.h"
  14. #include "core/basics/Config.h"
  15. namespace OBJREC {
  16. /** read local features from file */
  17. class LFReadCache : public LocalFeatureRepresentation
  18. {
  19. protected:
  20. int numFeatures;
  21. const LocalFeatureRepresentation *lfrep;
  22. std::string cachedir;
  23. int descFormat;
  24. int cachemode;
  25. template <class ImageClass>
  26. int extractFeaturesTemplate ( const ImageClass & img,
  27. NICE::VVector & features,
  28. NICE::VVector & positions) const;
  29. public:
  30. /** constructor
  31. * @param conf Configuration
  32. * @param lfrep a LocalFeatureRepresentation (i.e. LFColorSande)
  33. * @param _numfeatures how many features should be returned (-1 for all)
  34. */
  35. LFReadCache( const NICE::Config *conf,
  36. const LocalFeatureRepresentation *lfrep,
  37. int _numFeatures = -1 );
  38. /** simple destructor */
  39. virtual ~LFReadCache();
  40. int getDescSize () const;
  41. /**
  42. * extract features for gray images
  43. * @param img input image
  44. * @param features output features
  45. * @param positions position of the features
  46. * @return
  47. */
  48. int extractFeatures ( const NICE::Image & img,
  49. NICE::VVector & features,
  50. NICE::VVector & positions ) const;
  51. /**
  52. * extract features for color images
  53. * @param img input image
  54. * @param features output features
  55. * @param positions position of the features
  56. * @return
  57. */
  58. int extractFeatures ( const NICE::ColorImage & img,
  59. NICE::VVector & features,
  60. NICE::VVector & positions ) const;
  61. void visualize ( NICE::Image & img,
  62. const NICE::Vector & feature ) const;
  63. void visualizeFeatures ( NICE::Image & mark,
  64. const NICE::VVector & positions,
  65. size_t color ) const;
  66. };
  67. } // namespace
  68. #include "LFReadCache.tcc"
  69. #endif