PPSuperregion.h 2.5 KB

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