PPSuperregion.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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 "objrec/segmentation/RSMeanShift.h"
  17. #ifdef NICE_USELIB_ICE
  18. #include <image_nonvis.h>
  19. #endif
  20. namespace OBJREC {
  21. class PPSuperregion : public Persistent
  22. {
  23. protected:
  24. //! the configfile
  25. const Config *conf;
  26. //! count of classes
  27. int classno;
  28. //! Shape features
  29. Examples shapefeats;
  30. //! classifier for shape features
  31. FPCRandomForests *rf;
  32. public:
  33. /** simple constructor */
  34. PPSuperregion();
  35. /** simple constructor */
  36. PPSuperregion(const Config *_conf);
  37. /** simple destructor */
  38. ~PPSuperregion();
  39. /**
  40. * set the count of classes
  41. * @param _classno count of classes
  42. */
  43. void setClassNo(int _classno);
  44. /** initialize the RelativeLocationPrior Variables*/
  45. void Init();
  46. /**
  47. * combines connected regions with the same label to superregions
  48. * @param regions the input regions
  49. * @param mask the mask for the regions
  50. * @param superregions the superregions
  51. * @param classes the classlabels of the superregions
  52. */
  53. #ifdef NICE_USELIB_ICE
  54. void getSuperregions(const Examples &regions, const NICE::Matrix &mask, std::vector<ice::Region> &superregions, std::vector<int> &classes, NICE::Matrix &smask);
  55. #endif
  56. /**
  57. * Lerne Form der Regionen an
  58. * @param regions input regions with size and position
  59. * @param mask
  60. */
  61. void trainShape(Examples &regions, NICE::Matrix &mask);
  62. /**
  63. * finish the priors maps
  64. */
  65. void finishShape(ClassNames &cn);
  66. /**
  67. * use shape pp
  68. * @param regions
  69. * @param mask
  70. */
  71. void optimizeShape(Examples &regions, NICE::Matrix &mask, NICE::MultiChannelImageT<double> & probabilities);
  72. /**
  73. * load data from an input stream
  74. * @param is input stream
  75. * @param format
  76. */
  77. void restore (std::istream & is, int format = 0);
  78. /**
  79. * write data to an output stream
  80. * @param os outputstream
  81. * @param format
  82. */
  83. void store (std::ostream & os, int format = 0) const;
  84. /**
  85. * clear all informations
  86. */
  87. void clear ();
  88. };
  89. } //namespace
  90. #endif