LFGenericLocal.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /**
  2. * @file LFGenericLocal.cpp
  3. * @brief generic local features
  4. * @author Erik Rodner
  5. * @date 02/05/2008
  6. */
  7. #ifdef NOVISUAL
  8. #include <vislearning/nice_nonvis.h>
  9. #else
  10. #include <vislearning/nice.h>
  11. #endif
  12. #include <iostream>
  13. #include <sstream>
  14. #include "vislearning/features/localfeatures/LFGenericLocal.h"
  15. #include "vislearning/features/localfeatures/LocalFeatureSift.h"
  16. #include "vislearning/features/localfeatures/IDRandomSampling.h"
  17. using namespace OBJREC;
  18. using namespace std;
  19. using namespace NICE;
  20. LFGenericLocal::LFGenericLocal( const Config *conf, int numFeatures )
  21. {
  22. lf = new LocalFeatureSift(conf);
  23. id = new IDRandomSampling(conf, numFeatures);
  24. }
  25. LFGenericLocal::~LFGenericLocal()
  26. {
  27. delete lf;
  28. }
  29. int LFGenericLocal::getDescSize () const
  30. {
  31. return lf->getDescSize();
  32. }
  33. int LFGenericLocal::extractFeatures ( const NICE::Image & img,
  34. VVector & features,
  35. VVector & positions ) const
  36. {
  37. id->getInterests ( img, positions );
  38. lf->getDescriptors ( img, positions, features );
  39. return 0;
  40. }
  41. void LFGenericLocal::visualizeFeatures ( NICE::Image & mark,
  42. const VVector & positions,
  43. size_t color ) const
  44. {
  45. lf->visualizeFeatures ( mark, positions, color );
  46. }