FCBagSift.cpp 1023 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. * @file FCBagSift.cpp
  3. * @brief Feature Factory for Bag of SIFT Features
  4. * @author Erik Rodner
  5. * @date 10/25/2007
  6. */
  7. #ifdef NOVISUAL
  8. #include <vislearning/nice_nonvis.h>
  9. #else
  10. #include <vislearning/nice.h>
  11. #endif
  12. #include <iostream>
  13. #include "vislearning/math/cluster/GSCluster.h"
  14. #include "vislearning/features/simplefeatures/FCBagSift.h"
  15. using namespace OBJREC;
  16. using namespace std;
  17. // refactor-nice.pl: check this substitution
  18. // old: using namespace ice;
  19. using namespace NICE;
  20. #define DEBUG_SIFTLOCATIONS
  21. FCBagSift::FCBagSift( const Config * conf,
  22. const LocalFeatureRepresentation *_lfrep )
  23. : FeatureFactory ( conf ), lfrep(_lfrep)
  24. {
  25. gs = new GSCluster ( conf );
  26. }
  27. FCBagSift::~FCBagSift()
  28. {
  29. delete gs;
  30. }
  31. int FCBagSift::convert ( const NICE::Image & img, NICE::Vector & vec )
  32. {
  33. VVector features;
  34. VVector positions;
  35. lfrep->extractFeatures ( img, features, positions );
  36. if ( features.size() <= 0 ) return -1;
  37. gs->signature ( features, vec );
  38. return 0;
  39. }