LFPatches.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /**
  2. * @file LFPatches.h
  3. * @brief simple patch based approach
  4. * @author Erik Rodner
  5. * @date 02/06/2008
  6. */
  7. #ifndef LFPATCHESINCLUDE
  8. #define LFPATCHESINCLUDE
  9. #ifdef NOVISUAL
  10. #include <vislearning/nice_nonvis.h>
  11. #else
  12. #include <vislearning/nice.h>
  13. #endif
  14. #include "core/basics/Config.h"
  15. #include "vislearning/image/ImagePyramid.h"
  16. #include "LocalFeatureRepresentation.h"
  17. #include "vislearning/features/localfeatures/InterestDetector.h"
  18. namespace OBJREC
  19. {
  20. /** simple patch based approach */
  21. class LFPatches: public LocalFeatureRepresentation
  22. {
  23. protected:
  24. enum
  25. {
  26. NORMALIZE_N01 = 0, NORMALIZE_NONE, NORMALIZE_STDDEV, NORMALIZE_MEAN
  27. };
  28. int xsize;
  29. int ysize;
  30. int normalization;
  31. std::auto_ptr<InterestDetector> id;
  32. int maxLevels;
  33. double scaleSpacing;
  34. int detectormode;
  35. int numPatches;
  36. void calcDescriptors(const ImagePyramid & imp, NICE::VVector & positions,
  37. NICE::VVector & features) const;
  38. public:
  39. /** simple constructor */
  40. LFPatches(const NICE::Config *conf, int numPatches);
  41. /** simple destructor */
  42. virtual ~LFPatches();
  43. int getDescSize() const;
  44. int extractFeatures(const NICE::Image & img, NICE::VVector & features,
  45. NICE::VVector & positions) const;
  46. void correctPositions(const ImagePyramid & imp, NICE::VVector & positions,
  47. NICE::VVector & positions_corrected) const;
  48. void visualize(NICE::Image & img, const NICE::Vector & feature) const;
  49. void visualizeFeatures(NICE::Image & mark, const NICE::VVector & positions,
  50. size_t color) const;
  51. //DIRTY for bofCreationSingleImage
  52. int calcDescriptor(const ImagePyramid & imp, const NICE::Vector & position,
  53. NICE::Vector & desc) const;
  54. };
  55. } // namespace
  56. #endif