LFReadCache.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /**
  2. * @file LFReadCache.h
  3. * @brief read local features from file
  4. * @author Erik Rodner, Alexander Freytag
  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. /** @class LFReadCache
  17. * @brief Read local features from file
  18. *
  19. */
  20. class LFReadCache : public LocalFeatureRepresentation
  21. {
  22. protected:
  23. int numFeatures;
  24. const LocalFeatureRepresentation *lfrep;
  25. std::string cachedir;
  26. int descFormat;
  27. int cachemode;
  28. template <class ImageClass>
  29. int extractFeaturesTemplate ( const ImageClass & img,
  30. NICE::VVector & features,
  31. NICE::VVector & positions) const;
  32. public:
  33. /** standard constructor
  34. * @param conf Configuration
  35. * @param lfrep a LocalFeatureRepresentation (i.e. LFColorSande)
  36. * @param _numfeatures how many features should be returned (-1 for all)
  37. * @param _section specify the block in the config object we read
  38. */
  39. LFReadCache( const NICE::Config *conf,
  40. const LocalFeatureRepresentation *lfrep,
  41. int _numFeatures = -1,
  42. const std::string & _section = "cache"
  43. );
  44. /** simple destructor */
  45. virtual ~LFReadCache();
  46. int getDescSize () const;
  47. /**
  48. * extract features for gray images
  49. * @param img input image
  50. * @param features output features
  51. * @param positions position of the features
  52. * @return
  53. */
  54. int extractFeatures ( const NICE::Image & img,
  55. NICE::VVector & features,
  56. NICE::VVector & positions ) const;
  57. /**
  58. * extract features for color images
  59. * @param img input image
  60. * @param features output features
  61. * @param positions position of the features
  62. * @return
  63. */
  64. int extractFeatures ( const NICE::ColorImage & img,
  65. NICE::VVector & features,
  66. NICE::VVector & positions ) const;
  67. void visualize ( NICE::Image & img,
  68. const NICE::Vector & feature ) const;
  69. void visualizeFeatures ( NICE::Image & mark,
  70. const NICE::VVector & positions,
  71. size_t color ) const;
  72. };
  73. } // namespace
  74. #include "LFReadCache.tcc"
  75. #endif