LFonHSG.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /**
  2. * @file LFonHSG.h
  3. * @brief This class can be used to calculate the positions of keyfeatures in a Honeyrate Structure Grid (HSG). Also the class call the normal getDescriptors methode from a given type of SIFT.
  4. * @author Eric Bach
  5. * @date 26.10.2011
  6. */
  7. #ifndef LFonHSGINCLUDE
  8. #define LFonHSGINCLUDE
  9. /** standard includes **/
  10. #include <iostream>
  11. #include <sstream>
  12. #include <string>
  13. #include <vector>
  14. /** NICE includes **/
  15. #include <core/image/Convert.h>
  16. #include <vislearning/nice.h>
  17. #include <core/basics/Config.h>
  18. #include <core/vector/VVector.h>
  19. /** LocalFeature*-header includes **/
  20. #include "LocalFeatureRepresentation.h"
  21. #include "GenericLocalFeatureSelection.h"
  22. /** STRINGTOOLS **/
  23. /** 1) boost **/
  24. #ifdef NICE_USELIB_BOOST
  25. #include <boost/tokenizer.hpp>
  26. /** 2) NICE (standard) **/
  27. #else
  28. #include <core/basics/StringTools.h>
  29. #endif
  30. namespace OBJREC
  31. {
  32. class LFonHSG : public LocalFeatureRepresentation
  33. {
  34. /* private member */
  35. private:
  36. /* parameter for the grid */
  37. //! stepwidhts of the grid
  38. int sampleScaling;
  39. //! which scales should be used
  40. std::string scales;
  41. //! vector which save the different scales
  42. std::vector <float> scalesV;
  43. /** Calculate the keypoint-positions by given imagesize, sample-spacing and scales.
  44. @brief The methode returns the calculated positions on a honeyrate-grid. This
  45. positions starts with (0;0).
  46. @param[in] unsigned int imageWidth - width (x) of the given image
  47. @param[in] unsigned int imageHeight - heigth (y) of the given image
  48. @param[in,out] NICE::VVector positions - destination for the calculated positions
  49. **/
  50. void getPositionsOnHSG ( const unsigned int imageWidth,
  51. const unsigned int imageHeight,
  52. NICE::VVector& positions ) const;
  53. //! simple methode to convert a string into float
  54. float strToFloat( const std::string str ) const;
  55. //! if true, print some log-output
  56. bool debug;
  57. //! the descritor instanz
  58. LocalFeature* lf;
  59. /* public member */
  60. public:
  61. //! simple contructor
  62. LFonHSG( const NICE::Config *conf, const std::string section = "HSG");
  63. //! simple desctructor
  64. ~LFonHSG();
  65. //! Returns the descriptorsize
  66. int getDescSize() const { return lf->getDescSize(); };
  67. //! Extract the descriptor-Values from a given grayscale-Image.
  68. int extractFeatures ( const NICE::Image & img, NICE::VVector & features, NICE::VVector & positions ) const;
  69. //! Extract the descriptor-Values from a given color-Image.
  70. int extractFeatures ( const NICE::ColorImage & cimg, NICE::VVector & features, NICE::VVector & positions ) const;
  71. //! Visualisierung
  72. void visualizeFeatures ( NICE::Image & mark, const NICE::VVector & positions, size_t color ) const;
  73. };
  74. }
  75. #endif