LFCache.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #include "vislearning/features/localfeatures/LFCache.h"
  2. #include <iostream>
  3. #include "vislearning/features/localfeatures/sift.h"
  4. #include "vislearning/baselib/Globals.h"
  5. #include "core/basics/StringTools.h"
  6. using namespace OBJREC;
  7. using namespace std;
  8. using namespace NICE;
  9. LFCache::LFCache( const Config *conf, LocalFeature *_lf ):lf(_lf)
  10. {
  11. cachedir = conf->gS("cache", "root");
  12. cachemode = Globals::getCacheMode ( conf->gS("cache", "mode", "cat") );
  13. std::string descFormat_s = conf->gS("cache", "descriptor_format", "binary_double");
  14. if ( descFormat_s == "binary_double" )
  15. descFormat = VVector::FILEFORMAT_BINARY_DOUBLE;
  16. else if ( descFormat_s == "binary_uchar" )
  17. descFormat = VVector::FILEFORMAT_BINARY_CHAR;
  18. else if ( descFormat_s == "text_line" )
  19. descFormat = VVector::FILEFORMAT_LINE;
  20. else if ( descFormat_s == "text_ice" )
  21. descFormat = VVector::FILEFORMAT_NICE;
  22. }
  23. LFCache::~LFCache()
  24. {
  25. }
  26. int LFCache::getDescriptors ( const NICE::Image & img, VVector & positions, VVector & descriptors ) const
  27. {
  28. return getDescriptorsTemplate<NICE::Image> ( img, positions, descriptors );
  29. }
  30. int LFCache::getDescriptors ( const NICE::ColorImage & cimg, VVector & positions, VVector & descriptors ) const
  31. {
  32. return getDescriptorsTemplate<NICE::ColorImage>(cimg, positions, descriptors );
  33. }
  34. void LFCache::visualizeFeatures ( NICE::Image & mark, const VVector & positions, size_t color ) const
  35. {
  36. lf->visualizeFeatures(mark, positions, color);
  37. }