GenericRegionSegmentationMethodSelection.h 1.5 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& methode)
  24. {
  25. RegionSegmentationMethod* segmentationAlgo = NULL;
  26. if (methode == "MarkovCluster")
  27. {
  28. segmentationAlgo = new RSMarkovCluster(conf);
  29. }
  30. else if (methode == "GraphBased")
  31. {
  32. segmentationAlgo = new RSGraphBased(conf);
  33. }
  34. else if (methode == "MeanShift")
  35. {
  36. segmentationAlgo = new RSMeanShift(conf);
  37. }
  38. else if (methode == "SLIC")
  39. {
  40. segmentationAlgo = new RSSlic(conf);
  41. }
  42. if ( segmentationAlgo == NULL )
  43. {
  44. fthrow(Exception, "Region Segmentation Method not found: " << methode );
  45. return segmentationAlgo;
  46. }
  47. return segmentationAlgo;
  48. };
  49. };
  50. }
  51. #endif