SemanticSegmentation.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /**
  2. * @file SemanticSegmentation.h
  3. * @brief abstract interface for semantic segmentation algorithms
  4. * @author Erik Rodner
  5. * @date 03/19/2009
  6. */
  7. #ifndef SEMANTICSEGMENTATIONINCLUDE
  8. #define SEMANTICSEGMENTATIONINCLUDE
  9. #include <vector>
  10. #include "semseg3d/image/MultiChannelImage3DT.h"
  11. #include "vislearning/cbaselib/MultiDataset.h"
  12. #include "vislearning/cbaselib/LocalizationResult.h"
  13. #include "vislearning/cbaselib/CachedExample.h"
  14. #include "vislearning/cbaselib/Example.h"
  15. namespace OBJREC
  16. {
  17. /** abstract interface for semantic segmentation algorithms */
  18. class SemanticSegmentation
  19. {
  20. protected:
  21. /** accessible class names and information about
  22. number of classes etc. */
  23. const ClassNames *classNames;
  24. /** enum type for imagetype */
  25. enum
  26. {
  27. IMAGETYPE_RGB = 0,
  28. IMAGETYPE_GRAY
  29. };
  30. /** whether to load images with color information */
  31. int imagetype;
  32. public:
  33. /** simple constructor
  34. @param conf global settings
  35. @param classNames this ClassNames object while be stored as a attribute
  36. */
  37. SemanticSegmentation ( const NICE::Config *conf,
  38. const ClassNames *classNames );
  39. /** simple destructor */
  40. virtual ~SemanticSegmentation();
  41. /** this function has to be overloaded by all subclasses
  42. @param imgData image data
  43. @param segresult result of the semantic segmentation with a label for each
  44. pixel
  45. @param probabilities multi-channel image with one channel for each class and
  46. corresponding probabilities for each pixel
  47. */
  48. /**
  49. * collect information about the depth of 3d images
  50. * @param *Files a labeled set of data
  51. * @param depthVec output of depth values
  52. */
  53. void getDepthVector( const LabeledSet *Files, std::vector<int> & depthVec );
  54. virtual void semanticseg ( NICE::MultiChannelImage3DT<double> & imgData,
  55. NICE::MultiChannelImageT<double> & segresult,
  56. NICE::MultiChannelImage3DT<double> & probabilities,
  57. const std::vector<std::string> & filelist ) = 0;
  58. /**
  59. * convert different datatypes
  60. */
  61. void convertVVectorToExamples ( NICE::VVector &feats,OBJREC::Examples &examples, std::vector<int> &label );
  62. void convertExamplesToVVector ( NICE::VVector &feats,OBJREC::Examples &examples, std::vector<int> &label );
  63. void convertExamplesToLSet ( OBJREC::Examples &examples, OBJREC::LabeledSetVector &lvec );
  64. void convertLSetToExamples ( OBJREC::Examples &examples, OBJREC::LabeledSetVector &lvec );
  65. void convertLSetToSparseExamples ( OBJREC::Examples &examples, OBJREC::LabeledSetVector &lvec );
  66. /**
  67. *load image slices into a single MCI3DT
  68. */
  69. void make3DImage ( const std::vector<std::string> & filelist,
  70. NICE::MultiChannelImage3DT<double> & imgData );
  71. };
  72. } // namespace
  73. #endif