ImageInfo.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. /** localization info + image filename + ? */
  23. class ImageInfo
  24. {
  25. protected:
  26. std::string imagefn;
  27. LocalizationResult *lr;
  28. bool localization_info;
  29. #ifdef NICE_USELIB_QT4_XML
  30. Polygon polyFromData(QString *aPolyData);
  31. BoundingBox BBoxFromData(QString *aBBoxData);
  32. void loadLegendFromElement(QDomElement *anElement);
  33. bool loadCategoryInfo(QDomElement *anElement);
  34. ImageT< unsigned int > imageTFromData(
  35. const int &aWidth,
  36. const int &aHeight,
  37. QString *aPureData
  38. );
  39. #endif //NICE_USELIB_QT4_XML
  40. public:
  41. /** simple constructor */
  42. ImageInfo( const std::string & _imagefn, LocalizationResult *_lr ) :
  43. imagefn(_imagefn), lr(_lr), localization_info(true) {};
  44. ImageInfo() {};
  45. ImageInfo( const std::string & _imagefn ) :
  46. imagefn(_imagefn), lr(NULL), localization_info(false) {};
  47. /** simple destructor */
  48. virtual ~ImageInfo();
  49. const std::string & img () const { return imagefn; };
  50. const LocalizationResult *localization () const { assert(localization_info); return lr; };
  51. bool hasLocalizationInfo () const { return localization_info; };
  52. bool loadImageInfo(const std::string &aFilename);
  53. const std::list< CategoryInfo > * labels() const;
  54. const std::list< BoundingBox > * bboxes() const;
  55. const std::list< Polygon > * polys() const;
  56. ImageT< unsigned int > labeledImage() const;
  57. std::string tags() const;
  58. std::string imagePath() const;
  59. std::string imageDescription() const;
  60. std::string segmentedImagePath() const;
  61. private:
  62. std::list< CategoryInfo > labels_;
  63. std::list< BoundingBox > bboxes_;
  64. std::list< Polygon > polys_;
  65. ImageT< unsigned int > labeled_image_;
  66. //std::list< std::string > tags_;
  67. std::string tags_;
  68. std::string image_path_;
  69. std::string image_description_;
  70. std::string segmented_image_path_;
  71. };
  72. } // namespace
  73. #endif