LFReadCache.h 1.9 KB

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