PPSuperregion.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. #ifdef NICE_USELIB_ICE
  8. #ifndef PPSUPERREGIONINCLUDE
  9. #define PPSUPERREGIONINCLUDE
  10. #include <objrec/nice.h>
  11. #include "objrec/image/GenericImage.h"
  12. #include "objrec/cbaselib/CachedExample.h"
  13. #include "objrec/baselib/Preprocess.h"
  14. #include "objrec/baselib/Globals.h"
  15. #include "objrec/classifier/fpclassifier/randomforest/FPCRandomForests.h"
  16. #include "objrec/cbaselib/VectorFeature.h"
  17. #include "objrec/cbaselib/ClassNames.h"
  18. #include "objrec/segmentation/RSMeanShift.h"
  19. #include <image_nonvis.h>
  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. void getSuperregions(const Examples &regions, const NICE::Matrix &mask, vector<ice::Region> &superregions, vector<int> &classes, NICE::Matrix &smask);
  54. /**
  55. * Lerne Form der Regionen an
  56. * @param regions input regions with size and position
  57. * @param mask
  58. */
  59. void trainShape(Examples &regions, NICE::Matrix &mask);
  60. /**
  61. * finish the priors maps
  62. */
  63. void finishShape(ClassNames &cn);
  64. /**
  65. * use shape pp
  66. * @param regions
  67. * @param mask
  68. */
  69. void optimizeShape(Examples &regions, NICE::Matrix &mask, GenericImage<double> & probabilities);
  70. /**
  71. * load data from an input stream
  72. * @param is input stream
  73. * @param format
  74. */
  75. void restore (istream & is, int format = 0);
  76. /**
  77. * write data to an output stream
  78. * @param os outputstream
  79. * @param format
  80. */
  81. void store (ostream & os, int format = 0) const;
  82. /**
  83. * clear all informations
  84. */
  85. void clear ();
  86. };
  87. } //namespace
  88. #endif
  89. #endif