RegionSegmentationMethod.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /**
  2. * @file RegionSegmentationMethod.h
  3. * @brief abstract interface for region segmantation
  4. * @author Björn Fröhlich
  5. * @date 05/05/2009
  6. */
  7. #ifndef REGIONSEGMENTATIONMETHOD
  8. #define REGIONSEGMENTATIONMETHOD
  9. #include "core/basics/Config.h"
  10. #include <vector>
  11. #undef DEBUGRS
  12. #include "RegionGraph.h"
  13. #include "core/image/MultiChannelImage3DT.h"
  14. namespace OBJREC {
  15. class RegionSegmentationMethod
  16. {
  17. protected:
  18. const NICE::Config *conf;
  19. public:
  20. /** simple constructor */
  21. RegionSegmentationMethod();
  22. /** simple constructor */
  23. RegionSegmentationMethod(const NICE::Config *c );
  24. /** simple destructor */
  25. virtual ~RegionSegmentationMethod();
  26. /**
  27. * returns the regions of a given image
  28. * @param img input image
  29. * @param mask output regions, each region has it own number
  30. * @return count of region
  31. */
  32. virtual int segRegions ( const NICE::Image & img, NICE::Matrix & mask ) const = 0;
  33. /**
  34. * returns the regions of a given image
  35. * @param img input color image
  36. * @param mask output regions, each region has it own number
  37. * @return count of region
  38. */
  39. virtual int segRegions ( const NICE::ColorImage & cimg, NICE::Matrix & mask) const;
  40. /**
  41. * returns the regions of a given 3d image
  42. * @param img input 3d image data
  43. * @param mask output regions for each image slice, each region has it own number
  44. * @param isGray grayscale image or not
  45. * @return amount of regions
  46. */
  47. virtual int segRegions (const NICE::MultiChannelImage3DT<double> & img, NICE::MultiChannelImageT<int> & mask, const int isGray) const;
  48. /**
  49. * transform a segmented color image in a grayimage, where each region has its own label
  50. * @param img input image
  51. * @param mask output mask
  52. * @return count of regions
  53. */
  54. int transformSegmentedImg( const NICE::ColorImage & img, NICE::Matrix & mask) const;
  55. /**
  56. * get the Graph representation of an segmentationa
  57. * @param cimg input color image
  58. * @param mask result mask of the regions
  59. * @param rg graph representation
  60. */
  61. void getGraphRepresentation(const NICE::ColorImage & cimg, NICE::Matrix & mask, RegionGraph & rg);
  62. /**
  63. * @brief mark contours with given segmentation
  64. *
  65. * @param cimg input image
  66. * @param mask result segmentation
  67. * @param color RGB values of marking color
  68. * @param marked resultimage
  69. * @return void
  70. **/
  71. void markContours ( const NICE::ColorImage & cimg, NICE::Matrix & mask, std::vector<int> &color, NICE::ColorImage &marked );
  72. /**
  73. * visualize the graph representation
  74. * @param cimg input color image
  75. * @param mask result mask of the regions
  76. */
  77. void visualizeGraphRepresentation(const NICE::ColorImage & cimg, NICE::Matrix & mask);
  78. };
  79. } // namespace
  80. #endif