GenericRegionSegmentationMethodSelection.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. namespace OBJREC
  14. {
  15. class GenericRegionSegmentationMethodSelection
  16. {
  17. public:
  18. /**
  19. * @brief Return a instanz of the segmentationmethode which has defined in [segmenatation]:methode within conf.
  20. * @return RegionSegmentationMethod*, if methode is defined; NULL, else
  21. */
  22. static RegionSegmentationMethod*
  23. selectRegionSegmentationMethod(const Config* conf, const std::string& section = "segmentation")
  24. {
  25. RegionSegmentationMethod* segmentationAlgo = NULL;
  26. std::string methode = conf->gS(section, "methode", "");
  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(Exception, "Region Segmentation Method not found: " << methode );
  46. return segmentationAlgo;
  47. }
  48. return segmentationAlgo;
  49. };
  50. };
  51. }
  52. #endif