LFonHSG.h 2.8 KB

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