MSReadme.txt 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. Mean Shift Image Processor Class ver1.0 README
  2. ----------------------------------------------
  3. Class Overview:
  4. ===============
  5. The mean shift image processor class is designed to offer the following functionality:
  6. (1) Perform image segmentation and edge-preserving filtering using the mean shift algorithm.
  7. (2) Perform (1) using a general kernel and/or an arbitrary input data space.
  8. Table of Contents:
  9. -------------------
  10. (A) Image Segmentation and Filtering
  11. (B) Synergistic Image Segmentation
  12. (C) Using a General Kernel
  13. (D) Using an Arbitrary Input Data Space
  14. (E) The Class Error Handler
  15. (F) Current Version Information
  16. (G) References
  17. (H) Contact Information
  18. ================================================================================================
  19. (A) Image Segmentation and Filtering
  20. -------------------------------------------------------------------------------------------------
  21. Mean shift based image segmentation and filtering is performed using use the following methods:
  22. msImageProcess::Filter - filters the image
  23. msImageProcessor::Segment - segments the image
  24. The input image processed by these methods is defined via the method,
  25. msImageProcessor::DefineImage - this uploads the RGB data into the msImageProcessor class for processing
  26. To obtain the output call:
  27. msImageProcessor::GetResults - returns filtered or segmented image in RGB space
  28. msImageProcessor::GetBoundaries - returns the boundaries of regions resulting from filtering
  29. or segmentation
  30. msImageProcessor::GetRegions - returns the classification structure that maps each
  31. data point in the image to a given mode, and also
  32. the number of points in the image correlating to each mode.
  33. NOTE:
  34. -----
  35. The modes returned by GetRegions are not in the RGB space. If DefineImage was used, they are in the LUV space. The modes may be converted from LUV to RGB (and visa versa) using the space conversion methods of the msImageProcessor class:
  36. msImageProcessor::RGBtoLUV - converts data points from the RGB data space to LUV
  37. msImageProcessor::LUVtoRGB - converts data points from the LUV data space to RGB
  38. Alternatively, mean shift may be applyed to data that lies in a space other than LUV. This may be accomplished through the use of the method MeanShift::DefineLInput (see section D).
  39. ================================================================================================
  40. (B) Synergistic Image Segmentation
  41. -------------------------------------------------------------------------------------------------
  42. A weight map may be provided to the mean shift image processor class, used to perform synergistic image segmentation as described in the paper [3]. One may specify a weight map by calling either of the following methods:
  43. MeanShift::SetWeightMap - defines the weight map used to specify a weighted kernel during
  44. mean shift; the weight map may only be used for data that lies
  45. on a lattice (e.g. an image)
  46. msImageProcessor::SetWeightMap - specifies a weight map to be used for performing synergistic image
  47. segmentation
  48. Each of the above methods accept a floating point array of size L elements containing the weight map. When using the mean shift base class L is the number of data points in the specified data set; when using the image processor class L = height x width, where height and width are the dimensions of the image. The method msImageProcessor::SetWeightMap accepts an additional parameter, namely t_e, a threshold value used during the transitive closure step of the image segmentation algorithm. See the paper [3] for details.
  49. ================================================================================================
  50. (C) Using a General Kernel
  51. -------------------------------------------------------------------------------------------------
  52. A general kernel can be used to perform mean shift filtering and segmentation by calling the inherited method:
  53. MeanShift::DefineKernel - defines an N-dimensional kernel having kp subspaces, in which each subspace
  54. can be of one of three types: Uniform, Gaussian, or UserDefined.
  55. DefineImage, used to define the input image when performing image segmentation or filtering, defines a Uniform kernel having two subspaces (one spatial (x,y) and one range (L,U,V)) each subspace having bandwidths sigmaS and sigmaR respectively. By skimming the method definition one may get an idea of how to define a general kernel.
  56. NOTE:
  57. ----
  58. For data that is defined on a lattice, it is always assumed that the spatial domain is treated as a single subspace. Also, DefineKernel() must be called *after* DefineImage() when these methods are used together.
  59. ================================================================================================
  60. (D) Using an Arbitrary Input Data Space
  61. -------------------------------------------------------------------------------------------------
  62. Mean shift filtering and segmentation may be performed on an arbitary image data space. Such data is defined through calling the inherited method:
  63. MeanShift::DefineLInput - specifies input defined on a lattice
  64. DefineImage() calls this method using the LUV data it generates. Through the use of the above methods, mean shift may be applied to an arbitrary input data space using a general kernel. In doing so, one must ensure that the dimension of the input data space and kernel are the same (N). If their dimensions do not agree an error will be flagged.
  65. ================================================================================================
  66. (F) The Class Error Handler
  67. -------------------------------------------------------------------------------------------------
  68. The mean shift image processor class uses an error message string and error-level flag to perform error handling. These two variables, MeanShift::ErrorMessage and MeanShift::ErrorLevel, are public data members of the class.
  69. Upon the occurance of an error,
  70. * An error message is copied into the error message string.
  71. * The error level of the class is set to EL_ERROR.
  72. The following example demonstrates the use of the error handling mechanism described above.
  73. msImageProcessor iProc;
  74. ...
  75. iProc.Segment(sigmaS, sigmaR, minRegion, SPEEDUP);
  76. if(iProc.ErrorLevel == EL_ERROR)
  77. {
  78. fprintf(stderr, iProc.ErrorMessage);
  79. exit(1);
  80. }
  81. ...
  82. ================================================================================================
  83. (G) Current Version Information
  84. -------------------------------------------------------------------------------------------------
  85. The current version of the code was tested under both UNIX and Windows environments.
  86. ================================================================================================
  87. (H) References
  88. -------------------------------------------------------------------------------------------------
  89. [1] D. Comanicu, P. Meer: "Mean shift: A robust approach toward feature space analysis".
  90. IEEE Trans. Pattern Anal. Machine Intell., May 2002.
  91. [2] P. Meer, B. Georgescu: "Edge detection with embedded confidence". IEEE Trans. Pattern Anal.
  92. Machine Intell., 28, 2001.
  93. [3] C. Christoudias, B. Georgescu, P. Meer: "Synergism in low level vision". 16th International
  94. Conference of Pattern Recognition, Track 1 - Computer Vision and Robotics, Quebec City,
  95. Canada, August 2001.
  96. ================================================================================================
  97. (I) Contact Information
  98. -------------------------------------------------------------------------------------------------
  99. Personal Contact Information
  100. ----------------------------
  101. Email:
  102. cmch@caip.rutgers.edu (Chris Christoudias)
  103. georgesc@caip.rutgers.edu (Bogdan Georgescu)
  104. Laboratory Contact Information
  105. ------------------------------
  106. Laboratory Website:
  107. www.caip.rutgers.edu/riul/
  108. ================================================================================================