computeLocalFeatures.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #include <iostream>
  2. #include <fstream>
  3. #include <core/image/ImageT.h>
  4. #include <core/basics/Config.h>
  5. #include <vislearning/baselib/Globals.h>
  6. #include <vislearning/cbaselib/MultiDataset.h>
  7. #include <vislearning/features/localfeatures/LFonHSG.h>
  8. #include <vislearning/features/localfeatures/LFWriteCache.h>
  9. using namespace std;
  10. using namespace NICE;
  11. using namespace OBJREC;
  12. int main(int argc, char **argv)
  13. {
  14. Config conf ( argc, argv );
  15. string destForFeat = conf.gS("main", "destForFeat", "/tmp/");
  16. bool verbose = conf.gB("main", "verbose", false);
  17. MultiDataset md ( &conf );
  18. const LabeledSet & all = *(md["all"]);
  19. const ClassNames & classNames = md.getClassNames("all");
  20. LocalFeatureRepresentation *lfrep = NULL;
  21. lfrep = new LFonHSG(&conf);
  22. LocalFeatureRepresentation *lfrep_save = new LFWriteCache ( &conf, lfrep );
  23. lfrep = lfrep_save;
  24. LOOP_ALL_S ( all )
  25. {
  26. EACH_S(classno, imgfilename);
  27. Globals::setCurrentImgFN ( imgfilename );
  28. if (verbose)
  29. std::cerr << "imgfilename: " << imgfilename << std::endl;
  30. Image img (imgfilename);
  31. NICE::VVector positions;
  32. NICE::VVector features;
  33. // Extract the descriptor-Values from a given grayscale-Image.
  34. lfrep->extractFeatures ( img, features, positions );
  35. if (verbose)
  36. std::cerr << "features.size: " << features.size() << std::endl;
  37. }
  38. return 0;
  39. }