PPSuperregion.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /**
  2. * @file PPSuperregion.h
  3. * @brief a post procession step after semantic segmentation which use a variant of Region Growing
  4. * @author Björn Fröhlich
  5. * @date 08/19/2009
  6. */
  7. #ifndef PPSUPERREGIONINCLUDE
  8. #define PPSUPERREGIONINCLUDE
  9. #include "core/image/MultiChannelImageT.h"
  10. #include "vislearning/cbaselib/CachedExample.h"
  11. #include "vislearning/baselib/Preprocess.h"
  12. #include "vislearning/baselib/Globals.h"
  13. #include "vislearning/classifier/fpclassifier/randomforest/FPCRandomForests.h"
  14. #include "vislearning/cbaselib/VectorFeature.h"
  15. #include "vislearning/cbaselib/ClassNames.h"
  16. #include "segmentation/RSMeanShift.h"
  17. #ifdef NICE_USELIB_ICE
  18. #include <image_nonvis.h>
  19. #endif
  20. namespace OBJREC
  21. {
  22. class PPSuperregion : public NICE::Persistent
  23. {
  24. protected:
  25. //! the configfile
  26. const NICE::Config *conf;
  27. //! count of classes
  28. int classno;
  29. //! Shape features
  30. Examples shapefeats;
  31. //! classifier for shape features
  32. FPCRandomForests *rf;
  33. public:
  34. /** simple constructor */
  35. PPSuperregion();
  36. /** simple constructor */
  37. PPSuperregion ( const NICE::Config *_conf );
  38. /** simple destructor */
  39. ~PPSuperregion();
  40. /**
  41. * set the count of classes
  42. * @param _classno count of classes
  43. */
  44. void setClassNo ( int _classno );
  45. /** initialize the RelativeLocationPrior Variables*/
  46. void Init();
  47. /**
  48. * combines connected regions with the same label to superregions
  49. * @param regions the input regions
  50. * @param mask the mask for the regions
  51. * @param superregions the superregions
  52. * @param classes the classlabels of the superregions
  53. */
  54. #ifdef NICE_USELIB_ICE
  55. void getSuperregions ( const Examples &regions, const NICE::Matrix &mask, std::vector<ice::Region> &superregions, std::vector<int> &classes, NICE::Matrix &smask );
  56. #endif
  57. /**
  58. * Lerne Form der Regionen an
  59. * @param regions input regions with size and position
  60. * @param mask
  61. */
  62. void trainShape ( Examples &regions, NICE::Matrix &mask );
  63. /**
  64. * finish the priors maps
  65. */
  66. void finishShape ( ClassNames &cn );
  67. /**
  68. * use shape pp
  69. * @param regions
  70. * @param mask
  71. */
  72. void optimizeShape ( Examples &regions, NICE::Matrix &mask, NICE::MultiChannelImageT<double> & probabilities );
  73. /**
  74. * load data from an input stream
  75. * @param is input stream
  76. * @param format
  77. */
  78. void restore ( std::istream & is, int format = 0 );
  79. /**
  80. * write data to an output stream
  81. * @param os outputstream
  82. * @param format
  83. */
  84. void store ( std::ostream & os, int format = 0 ) const;
  85. /**
  86. * clear all informations
  87. */
  88. void clear ();
  89. };
  90. } //namespace
  91. #endif