ImageInfo.h 2.3 KB

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