morphology.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /*
  2. Copyright 1999 ImageMagick Studio LLC, a non-profit organization
  3. dedicated to making software imaging solutions freely available.
  4. You may not use this file except in compliance with the License. You may
  5. obtain a copy of the License at
  6. https://imagemagick.org/script/license.php
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. MagickCore morphology methods.
  13. */
  14. #ifndef MAGICKCORE_MORPHOLOGY_H
  15. #define MAGICKCORE_MORPHOLOGY_H
  16. #include "magick/geometry.h"
  17. #if defined(__cplusplus) || defined(c_plusplus)
  18. extern "C" {
  19. #endif
  20. typedef enum
  21. {
  22. UndefinedKernel, /* equivalent to UnityKernel */
  23. UnityKernel, /* The no-op or 'original image' kernel */
  24. GaussianKernel, /* Convolution Kernels, Gaussian Based */
  25. DoGKernel,
  26. LoGKernel,
  27. BlurKernel,
  28. CometKernel,
  29. LaplacianKernel, /* Convolution Kernels, by Name */
  30. SobelKernel,
  31. FreiChenKernel,
  32. RobertsKernel,
  33. PrewittKernel,
  34. CompassKernel,
  35. KirschKernel,
  36. DiamondKernel, /* Shape Kernels */
  37. SquareKernel,
  38. RectangleKernel,
  39. OctagonKernel,
  40. DiskKernel,
  41. PlusKernel,
  42. CrossKernel,
  43. RingKernel,
  44. PeaksKernel, /* Hit And Miss Kernels */
  45. EdgesKernel,
  46. CornersKernel,
  47. DiagonalsKernel,
  48. LineEndsKernel,
  49. LineJunctionsKernel,
  50. RidgesKernel,
  51. ConvexHullKernel,
  52. ThinSEKernel,
  53. SkeletonKernel,
  54. ChebyshevKernel, /* Distance Measuring Kernels */
  55. ManhattanKernel,
  56. OctagonalKernel,
  57. EuclideanKernel,
  58. UserDefinedKernel, /* User Specified Kernel Array */
  59. BinomialKernel
  60. } KernelInfoType;
  61. typedef enum
  62. {
  63. UndefinedMorphology,
  64. /* Convolve / Correlate weighted sums */
  65. ConvolveMorphology, /* Weighted Sum with reflected kernel */
  66. CorrelateMorphology, /* Weighted Sum using a sliding window */
  67. /* Low-level Morphology methods */
  68. ErodeMorphology, /* Minimum Value in Neighbourhood */
  69. DilateMorphology, /* Maximum Value in Neighbourhood */
  70. ErodeIntensityMorphology, /* Pixel Pick using GreyScale Erode */
  71. DilateIntensityMorphology, /* Pixel Pick using GreyScale Dialate */
  72. DistanceMorphology, /* Add Kernel Value, take Minimum */
  73. /* Second-level Morphology methods */
  74. OpenMorphology, /* Dilate then Erode */
  75. CloseMorphology, /* Erode then Dilate */
  76. OpenIntensityMorphology, /* Pixel Pick using GreyScale Open */
  77. CloseIntensityMorphology, /* Pixel Pick using GreyScale Close */
  78. SmoothMorphology, /* Open then Close */
  79. /* Difference Morphology methods */
  80. EdgeInMorphology, /* Dilate difference from Original */
  81. EdgeOutMorphology, /* Erode difference from Original */
  82. EdgeMorphology, /* Dilate difference with Erode */
  83. TopHatMorphology, /* Close difference from Original */
  84. BottomHatMorphology, /* Open difference from Original */
  85. /* Recursive Morphology methods */
  86. HitAndMissMorphology, /* Foreground/Background pattern matching */
  87. ThinningMorphology, /* Remove matching pixels from image */
  88. ThickenMorphology, /* Add matching pixels from image */
  89. /* Experimental Morphology methods */
  90. VoronoiMorphology, /* distance matte channel copy nearest color */
  91. IterativeDistanceMorphology /* Add Kernel Value, take Minimum */
  92. } MorphologyMethod;
  93. typedef struct KernelInfo
  94. {
  95. KernelInfoType
  96. type;
  97. size_t
  98. width,
  99. height;
  100. ssize_t
  101. x,
  102. y;
  103. double
  104. *values,
  105. minimum,
  106. maximum,
  107. negative_range,
  108. positive_range,
  109. angle;
  110. struct KernelInfo
  111. *next;
  112. size_t
  113. signature;
  114. } KernelInfo;
  115. extern MagickExport KernelInfo
  116. *AcquireKernelInfo(const char *),
  117. *AcquireKernelBuiltIn(const KernelInfoType,const GeometryInfo *),
  118. *CloneKernelInfo(const KernelInfo *),
  119. *DestroyKernelInfo(KernelInfo *);
  120. extern MagickExport Image
  121. *MorphologyImage(const Image *,const MorphologyMethod,const ssize_t,
  122. const KernelInfo *,ExceptionInfo *),
  123. *MorphologyImageChannel(const Image *,const ChannelType,
  124. const MorphologyMethod,const ssize_t,const KernelInfo *,ExceptionInfo *);
  125. extern MagickExport void
  126. ScaleGeometryKernelInfo(KernelInfo *,const char *),
  127. ScaleKernelInfo(KernelInfo *,const double,const GeometryFlags),
  128. ShowKernelInfo(const KernelInfo *),
  129. UnityAddKernelInfo(KernelInfo *,const double);
  130. #if defined(__cplusplus) || defined(c_plusplus)
  131. }
  132. #endif
  133. #endif