RSSlic.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /**
  2. * @file RSSlic.h
  3. * @brief SLIC Superpixels from "SLIC Superpixels Compared to State-of-the-art Superpixel Methods,"
  4. * @author Björn Fröhlich, Alexander Freytag
  5. * @date 02/02/2013
  6. */
  7. #ifndef RSSlicINCLUDE
  8. #define RSSlicINCLUDE
  9. #include "core/basics/Config.h"
  10. #include "RegionSegmentationMethod.h"
  11. namespace OBJREC {
  12. class RSSlic: public RegionSegmentationMethod
  13. {
  14. protected:
  15. /////////////////////////
  16. /////////////////////////
  17. // PROTECTED VARIABLES //
  18. /////////////////////////
  19. /////////////////////////
  20. //!number of regions
  21. int spcount;
  22. //!value between 0 and 40
  23. double compactness;
  24. //!average size of each region
  25. int regionsize;
  26. //!use lab space or not
  27. bool b_lab;
  28. public:
  29. ///////////////////// ///////////////////// /////////////////////
  30. // CONSTRUCTORS / DESTRUCTORS
  31. ///////////////////// ///////////////////// /////////////////////
  32. /** simple constructor */
  33. RSSlic();
  34. /**
  35. * standard constructor
  36. * @param conf config file
  37. */
  38. RSSlic( const NICE::Config * _conf );
  39. /** simple destructor */
  40. virtual ~RSSlic();
  41. /**
  42. * @brief Setup internal variables and objects used
  43. * @author Alexander Freytag
  44. * @param conf Config file to specify variable settings
  45. * @param s_confSection
  46. * @date 08-02-2014 ( dd-mm-yyyy )
  47. */
  48. virtual void initFromConfig ( const NICE::Config * _conf, const std::string & _confSection = "RSSlic" );
  49. ///////////////////// ///////////////////// /////////////////////
  50. // SEGMENTATION STUFF
  51. ///////////////////// ///////////////////// //////////////////
  52. /**
  53. * returns the regions of a given image
  54. * @param img input image
  55. * @param mask output regions, each region has it own number
  56. * @return count of region
  57. */
  58. virtual int segRegions ( const NICE::Image & img, NICE::Matrix & mask ) const;
  59. /**
  60. * returns the regions of a given image
  61. * @param img input color image
  62. * @param mask output regions, each region has it own number
  63. * @return count of region
  64. */
  65. virtual int segRegions ( const NICE::ColorImage & img, NICE::Matrix & mask) const;
  66. ///////////////////// INTERFACE PERSISTENT /////////////////////
  67. // interface specific methods for store and restore
  68. ///////////////////// INTERFACE PERSISTENT /////////////////////
  69. /**
  70. * @brief Load object from external file (stream)
  71. * @author Alexander Freytag
  72. * @date 08-02-2014 ( dd-mm-yyyy )
  73. */
  74. void restore ( std::istream & is, int format = 0 );
  75. /**
  76. * @brief Save object to external file (stream)
  77. * @author Alexander Freytag
  78. * @date 08-02-2014 ( dd-mm-yyyy )
  79. */
  80. void store ( std::ostream & os, int format = 0 ) const;
  81. /**
  82. * @brief Clear object
  83. * @author Alexander Freytag
  84. * @date 08-02-2014 ( dd-mm-yyyy )
  85. */
  86. void clear ();
  87. };
  88. } //namespace
  89. #endif