FCBagSift.cpp 926 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. #include <iostream>
  8. #include "vislearning/math/cluster/GSCluster.h"
  9. #include "vislearning/features/simplefeatures/FCBagSift.h"
  10. using namespace OBJREC;
  11. using namespace std;
  12. // refactor-nice.pl: check this substitution
  13. // old: using namespace ice;
  14. using namespace NICE;
  15. #define DEBUG_SIFTLOCATIONS
  16. FCBagSift::FCBagSift( const Config * conf,
  17. const LocalFeatureRepresentation *_lfrep )
  18. : FeatureFactory ( conf ), lfrep(_lfrep)
  19. {
  20. gs = new GSCluster ( conf );
  21. }
  22. FCBagSift::~FCBagSift()
  23. {
  24. delete gs;
  25. }
  26. int FCBagSift::convert ( const NICE::Image & img, NICE::Vector & vec )
  27. {
  28. VVector features;
  29. VVector positions;
  30. lfrep->extractFeatures ( img, features, positions );
  31. if ( features.size() <= 0 ) return -1;
  32. gs->signature ( features, vec );
  33. return 0;
  34. }