GenericRegionSegmentationMethodSelection.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /**
  2. * @brief Class which represents a generic RS selection.
  3. * @author Eric Bach
  4. * @date 03/05/12
  5. */
  6. #ifndef _NICE_OBJREC_SEGMENTATIONSELECTION_INCLUDE
  7. #define _NICE_OBJREC_SEGMENTATIONSELECTION_INCLUDE
  8. #include <segmentation/RegionSegmentationMethod.h>
  9. #include <segmentation/RSMarkovCluster.h>
  10. #include <segmentation/RSMeanShift.h>
  11. #include <segmentation/RSSlic.h>
  12. #include <segmentation/RSGraphBased.h>
  13. #include <segmentation/RSCache.h>
  14. namespace OBJREC
  15. {
  16. class GenericRegionSegmentationMethodSelection
  17. {
  18. public:
  19. /**
  20. * @brief Return an instance of the segmentation method which has been defined in [segmenatation]:methode using conf.
  21. * @return RegionSegmentationMethod*, if methode is defined; NULL, else
  22. */
  23. static RegionSegmentationMethod*
  24. selectRegionSegmentationMethod(const NICE::Config* conf, const std::string& methode)
  25. {
  26. RegionSegmentationMethod* segmentationAlgo = NULL;
  27. if (methode == "MarkovCluster")
  28. {
  29. segmentationAlgo = new RSMarkovCluster(conf);
  30. }
  31. else if (methode == "GraphBased")
  32. {
  33. segmentationAlgo = new RSGraphBased(conf);
  34. }
  35. else if (methode == "MeanShift")
  36. {
  37. segmentationAlgo = new RSMeanShift(conf);
  38. }
  39. else if (methode == "SLIC")
  40. {
  41. segmentationAlgo = new RSSlic(conf);
  42. }
  43. if ( segmentationAlgo == NULL )
  44. {
  45. fthrow(NICE::Exception, "Region Segmentation Method not found: " << methode );
  46. return segmentationAlgo;
  47. }
  48. return segmentationAlgo;
  49. };
  50. };
  51. }
  52. #endif