ImageInfo.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /**
  2. * @file ImageInfo.h
  3. * @brief localization info + image filename + ?
  4. * @author Erik Rodner
  5. * @date 04/16/2008
  6. */
  7. #ifndef IMAGEINFOINCLUDE
  8. #define IMAGEINFOINCLUDE
  9. #include "core/image/ImageT.h"
  10. #include "core/vector/VectorT.h"
  11. #include "core/vector/MatrixT.h"
  12. #include "vislearning/cbaselib/Polygon.h"
  13. #include "vislearning/cbaselib/BoundingBox.h"
  14. #include "vislearning/cbaselib/CategoryInfo.h"
  15. #include "LocalizationResult.h"
  16. #include <assert.h>
  17. #ifdef NICE_USELIB_QT4_XML
  18. class QString;
  19. class QDomElement;
  20. #endif //NICE_USELIB_QT4_XML
  21. namespace OBJREC
  22. {
  23. /** localization info + image filename + ? */
  24. class ImageInfo
  25. {
  26. protected:
  27. std::string imagefn;
  28. LocalizationResult *lr;
  29. bool localization_info;
  30. #ifdef NICE_USELIB_QT4_XML
  31. Polygon polyFromData ( QString *aPolyData );
  32. BoundingBox BBoxFromData ( QString *aBBoxData );
  33. void loadLegendFromElement ( QDomElement *anElement );
  34. bool loadCategoryInfo ( QDomElement *anElement );
  35. NICE::ImageT< unsigned int > imageTFromData (
  36. const int &aWidth,
  37. const int &aHeight,
  38. QString *aPureData
  39. );
  40. #endif //NICE_USELIB_QT4_XML
  41. public:
  42. /** simple constructor */
  43. ImageInfo ( const std::string & _imagefn, LocalizationResult *_lr ) :
  44. imagefn ( _imagefn ), lr ( _lr ), localization_info ( true ) {};
  45. ImageInfo() {};
  46. ImageInfo ( const std::string & _imagefn ) :
  47. imagefn ( _imagefn ), lr ( NULL ), localization_info ( false ) {};
  48. /** simple destructor */
  49. virtual ~ImageInfo();
  50. const std::string & img () const
  51. {
  52. return imagefn;
  53. };
  54. const LocalizationResult *localization () const
  55. {
  56. assert ( localization_info );
  57. return lr;
  58. };
  59. bool hasLocalizationInfo () const
  60. {
  61. return localization_info;
  62. };
  63. bool loadImageInfo ( const std::string &aFilename );
  64. const std::list< CategoryInfo > * labels() const;
  65. const std::list< BoundingBox > * bboxes() const;
  66. const std::list< Polygon > * polys() const;
  67. NICE::ImageT< unsigned int > labeledImage() const;
  68. std::string tags() const;
  69. std::string imagePath() const;
  70. std::string imageDescription() const;
  71. std::string segmentedImagePath() const;
  72. private:
  73. std::list< CategoryInfo > labels_;
  74. std::list< BoundingBox > bboxes_;
  75. std::list< Polygon > polys_;
  76. NICE::ImageT< unsigned int > labeled_image_;
  77. //std::list< std::string > tags_;
  78. std::string tags_;
  79. std::string image_path_;
  80. std::string image_description_;
  81. std::string segmented_image_path_;
  82. };
  83. } // namespace
  84. #endif