RSCache.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /**
  2. * @file RSCache.h
  3. * @brief read and save the RegionSegmentation
  4. * @author Björn Fröhlich
  5. * @date 05/07/2009
  6. */
  7. #ifndef RSCACHE
  8. #define RSCACHE
  9. #include "core/basics/Config.h"
  10. #include "RegionSegmentationMethod.h"
  11. namespace OBJREC
  12. {
  13. class RSCache: public RegionSegmentationMethod
  14. {
  15. protected:
  16. //! the RegionSegmentation method
  17. RegionSegmentationMethod *rsmethod;
  18. //! where to save or to load the caches data
  19. std::string cachedir;
  20. //! just write features, don't read them
  21. bool forcedwrite;
  22. public:
  23. /** simple constructor */
  24. RSCache ( const NICE::Config *conf, RegionSegmentationMethod *_rsmethod );
  25. /** simple destructor */
  26. virtual ~RSCache();
  27. /**
  28. * returns the regions of a given image
  29. * @param img input image
  30. * @param mask output regions, each region has it own number
  31. * @return count of region
  32. */
  33. virtual int segRegions ( const NICE::Image & img, NICE::Matrix & mask ) const;
  34. /**
  35. * returns the regions of a given image
  36. * @param img input colorimage
  37. * @param mask output regions, each region has it own number
  38. * @return count of region
  39. */
  40. virtual int segRegions ( const NICE::ColorImage & cimg, NICE::Matrix & mask ) const;
  41. ///////////////////// INTERFACE PERSISTENT /////////////////////
  42. // interface specific methods for store and restore
  43. ///////////////////// INTERFACE PERSISTENT /////////////////////
  44. /**
  45. * @brief Load object from external file (stream)
  46. * @author Alexander Freytag
  47. * @date 07-02-2014 ( dd-mm-yyyy )
  48. */
  49. void restore ( std::istream & is, int format = 0 );
  50. /**
  51. * @brief Save object to external file (stream)
  52. * @author Alexander Freytag
  53. * @date 07-02-2014 ( dd-mm-yyyy )
  54. */
  55. void store ( std::ostream & os, int format = 0 ) const;
  56. /**
  57. * @brief Clear object
  58. * @author Alexander Freytag
  59. * @date 07-02-2014 ( dd-mm-yyyy )
  60. */
  61. void clear ();
  62. };
  63. } // namespace
  64. #endif