LocalFeatureLFInterface.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /**
  2. * @file LocalFeatureLFInterface.h
  3. * @brief Interface to use a LocalFeature (Descriptor only) with routines of LocalFeatureRepresentations (Detector + Descriptor)
  4. * @author Björn Fröhlich, Alexander Freytag
  5. * @date 09/07/2010
  6. */
  7. #ifndef LocalFeatureLFInterfaceINCLUDE
  8. #define LocalFeatureLFInterfaceINCLUDE
  9. // nice-core includes
  10. #include <core/basics/Config.h>
  11. //
  12. #include <core/image/ImageT.h>
  13. //
  14. #include <core/vector/VectorT.h>
  15. #include <core/vector/MatrixT.h>
  16. // nice-vislearning includes
  17. #include "LocalFeature.h"
  18. #include "LocalFeatureRepresentation.h"
  19. namespace OBJREC {
  20. /** @class LocalFeatureLFInterface
  21. * @brief Interface to use a LocalFeature (Descriptor only) with routines of LocalFeatureRepresentations (Detector + Descriptor)
  22. *
  23. */
  24. class LocalFeatureLFInterface : public LocalFeature
  25. {
  26. protected:
  27. LocalFeatureRepresentation *lfpres;
  28. public:
  29. ///////////////////// ///////////////////// /////////////////////
  30. // CONSTRUCTORS / DESTRUCTORS
  31. ///////////////////// ///////////////////// /////////////////////
  32. /**
  33. * @brief default constructor
  34. * @author Alexander Freytag
  35. * @date 06-02-2014 ( dd-mm-yyyy )
  36. */
  37. LocalFeatureLFInterface ( );
  38. /**
  39. * @brief recommended constructor, calls initFromConfig
  40. * @author Alexander Freytag
  41. * @date 06-02-2014 ( dd-mm-yyyy )
  42. */
  43. LocalFeatureLFInterface ( const NICE::Config * _conf, LocalFeatureRepresentation *_lfpres );
  44. /**
  45. * @brief simple destructor
  46. */
  47. virtual ~LocalFeatureLFInterface();
  48. /**
  49. * @brief Jobs previously performed in the config-version of the constructor, read settings etc.
  50. * @author Alexander Freytag
  51. * @date 06-02-2014 ( dd-mm-yyyy )
  52. */
  53. virtual void initFromConfig ( const NICE::Config * _conf, const std::string & _confSection = "LocalFeatureLFInterface");
  54. ///////////////////// ///////////////////// /////////////////////
  55. // FEATURE STUFF
  56. ///////////////////// ///////////////////// //////////////////
  57. /**
  58. * @brief returns the size of each the SIFT-Feature
  59. */
  60. int getDescSize() const { return lfpres->getDescSize(); };
  61. /**
  62. * @brief get the descriptor
  63. * @param img input image
  64. * @param positions positions for local features
  65. * @param descriptors output
  66. * @return 0
  67. */
  68. int getDescriptors ( const NICE::Image & img, NICE::VVector & positions, NICE::VVector & descriptors ) const;
  69. /**
  70. * @brief get the descriptor
  71. * @param img input color image
  72. * @param positions positions for the SIFT features
  73. * @param descriptors output
  74. * @return 0
  75. */
  76. int getDescriptors ( const NICE::ColorImage & img, NICE::VVector & positions, NICE::VVector & descriptors) const;
  77. void visualizeFeatures ( NICE::Image & mark, const NICE::VVector & positions, size_t color ) const;
  78. ///////////////////// INTERFACE PERSISTENT /////////////////////
  79. // interface specific methods for store and restore
  80. ///////////////////// INTERFACE PERSISTENT /////////////////////
  81. /**
  82. * @brief Load object from external file (stream)
  83. * @author Alexander Freytag
  84. * @date 09-02-2014 ( dd-mmyyyy)
  85. */
  86. virtual void restore ( std::istream & is, int format = 0 );
  87. /**
  88. * @brief Save object to external file (stream)
  89. * @author Alexander Freytag
  90. * @date 09-02-2014 ( dd-mmyyyy)
  91. */
  92. virtual void store( std::ostream & os, int format = 0 ) const;
  93. /**
  94. * @brief Clear object
  95. * @author Alexander Freytag
  96. * @date 09-02-2014 ( dd-mmyyyy)
  97. */
  98. virtual void clear ();
  99. };
  100. } // namespace
  101. #endif