RegionSegmentationMethod.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. #undef DEBUGRS
  11. #include "RegionGraph.h"
  12. namespace OBJREC {
  13. class RegionSegmentationMethod
  14. {
  15. protected:
  16. const NICE::Config *conf;
  17. public:
  18. /** simple constructor */
  19. RegionSegmentationMethod();
  20. /** simple constructor */
  21. RegionSegmentationMethod(const NICE::Config *c );
  22. /** simple destructor */
  23. ~RegionSegmentationMethod();
  24. /**
  25. * returns the regions of a given image
  26. * @param img input image
  27. * @param mask output regions, each region has it own number
  28. * @return count of region
  29. */
  30. virtual int segRegions ( const NICE::Image & img, NICE::Matrix & mask ) const = 0;
  31. /**
  32. * returns the regions of a given image
  33. * @param img input color image
  34. * @param mask output regions, each region has it own number
  35. * @return count of region
  36. */
  37. virtual int segRegions ( const NICE::ColorImage & cimg, NICE::Matrix & mask) const;
  38. /**
  39. * transform a segmented color image in a grayimage, where each region has its own label
  40. * @param img input image
  41. * @param mask output mask
  42. * @return count of regions
  43. */
  44. int transformSegmentedImg( const NICE::ColorImage & img, NICE::Matrix & mask) const;
  45. /**
  46. * get the Graph representation of an segmentationa
  47. * @param cimg input color image
  48. * @param mask result mask of the regions
  49. * @param rg graph representation
  50. */
  51. void getGraphRepresentation(const NICE::ColorImage & cimg, NICE::Matrix & mask, RegionGraph & rg);
  52. /**
  53. * @brief mark contours with given segmentation
  54. *
  55. * @param cimg input image
  56. * @param mask result segmentation
  57. * @param color RGB values of marking color
  58. * @param marked resultimage
  59. * @return void
  60. **/
  61. void markContours ( const NICE::ColorImage & cimg, NICE::Matrix & mask, std::vector<int> &color, NICE::ColorImage &marked );
  62. /**
  63. * visualize the graph representation
  64. * @param cimg input color image
  65. * @param mask result mask of the regions
  66. */
  67. void visualizeGraphRepresentation(const NICE::ColorImage & cimg, NICE::Matrix & mask);
  68. };
  69. } // namespace
  70. #endif