statistic.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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 statistical methods.
  13. */
  14. #ifndef MAGICKCORE_STATISTIC_H
  15. #define MAGICKCORE_STATISTIC_H
  16. #if defined(__cplusplus) || defined(c_plusplus)
  17. extern "C" {
  18. #endif
  19. #include "magick/draw.h"
  20. #define MaximumNumberOfImageMoments 8
  21. #define MaximumNumberOfPerceptualHashes 7
  22. typedef struct _ChannelStatistics
  23. {
  24. size_t
  25. depth;
  26. double
  27. minima,
  28. maxima,
  29. sum,
  30. sum_squared,
  31. sum_cubed,
  32. sum_fourth_power,
  33. mean,
  34. variance,
  35. standard_deviation,
  36. kurtosis,
  37. skewness,
  38. entropy;
  39. } ChannelStatistics;
  40. #undef I
  41. typedef struct _ChannelMoments
  42. {
  43. double
  44. I[32];
  45. PointInfo
  46. centroid,
  47. ellipse_axis;
  48. double
  49. ellipse_angle,
  50. ellipse_eccentricity,
  51. ellipse_intensity;
  52. } ChannelMoments;
  53. typedef struct _ChannelPerceptualHash
  54. {
  55. double
  56. P[32],
  57. Q[32];
  58. } ChannelPerceptualHash;
  59. typedef enum
  60. {
  61. UndefinedEvaluateOperator,
  62. AddEvaluateOperator,
  63. AndEvaluateOperator,
  64. DivideEvaluateOperator,
  65. LeftShiftEvaluateOperator,
  66. MaxEvaluateOperator,
  67. MinEvaluateOperator,
  68. MultiplyEvaluateOperator,
  69. OrEvaluateOperator,
  70. RightShiftEvaluateOperator,
  71. SetEvaluateOperator,
  72. SubtractEvaluateOperator,
  73. XorEvaluateOperator,
  74. PowEvaluateOperator,
  75. LogEvaluateOperator,
  76. ThresholdEvaluateOperator,
  77. ThresholdBlackEvaluateOperator,
  78. ThresholdWhiteEvaluateOperator,
  79. GaussianNoiseEvaluateOperator,
  80. ImpulseNoiseEvaluateOperator,
  81. LaplacianNoiseEvaluateOperator,
  82. MultiplicativeNoiseEvaluateOperator,
  83. PoissonNoiseEvaluateOperator,
  84. UniformNoiseEvaluateOperator,
  85. CosineEvaluateOperator,
  86. SineEvaluateOperator,
  87. AddModulusEvaluateOperator,
  88. MeanEvaluateOperator,
  89. AbsEvaluateOperator,
  90. ExponentialEvaluateOperator,
  91. MedianEvaluateOperator,
  92. SumEvaluateOperator,
  93. RootMeanSquareEvaluateOperator,
  94. InverseLogEvaluateOperator
  95. } MagickEvaluateOperator;
  96. typedef enum
  97. {
  98. UndefinedFunction,
  99. PolynomialFunction,
  100. SinusoidFunction,
  101. ArcsinFunction,
  102. ArctanFunction
  103. } MagickFunction;
  104. typedef enum
  105. {
  106. UndefinedStatistic,
  107. GradientStatistic,
  108. MaximumStatistic,
  109. MeanStatistic,
  110. MedianStatistic,
  111. MinimumStatistic,
  112. ModeStatistic,
  113. NonpeakStatistic,
  114. StandardDeviationStatistic,
  115. RootMeanSquareStatistic
  116. } StatisticType;
  117. extern MagickExport ChannelStatistics
  118. *GetImageChannelStatistics(const Image *,ExceptionInfo *);
  119. extern MagickExport ChannelMoments
  120. *GetImageChannelMoments(const Image *,ExceptionInfo *);
  121. extern MagickExport ChannelPerceptualHash
  122. *GetImageChannelPerceptualHash(const Image *,ExceptionInfo *);
  123. extern MagickExport Image
  124. *EvaluateImages(const Image *,const MagickEvaluateOperator,ExceptionInfo *),
  125. *PolynomialImage(const Image *,const size_t,const double *,ExceptionInfo *),
  126. *PolynomialImageChannel(const Image *,const ChannelType,const size_t,
  127. const double *,ExceptionInfo *),
  128. *StatisticImage(const Image *,const StatisticType,const size_t,const size_t,
  129. ExceptionInfo *),
  130. *StatisticImageChannel(const Image *,const ChannelType,const StatisticType,
  131. const size_t,const size_t,ExceptionInfo *);
  132. extern MagickExport MagickBooleanType
  133. EvaluateImage(Image *,const MagickEvaluateOperator,const double,
  134. ExceptionInfo *),
  135. EvaluateImageChannel(Image *,const ChannelType,const MagickEvaluateOperator,
  136. const double,ExceptionInfo *),
  137. FunctionImage(Image *,const MagickFunction,const size_t,const double *,
  138. ExceptionInfo *),
  139. FunctionImageChannel(Image *,const ChannelType,const MagickFunction,
  140. const size_t,const double *,ExceptionInfo *),
  141. GetImageChannelEntropy(const Image *,const ChannelType,double *,
  142. ExceptionInfo *),
  143. GetImageChannelExtrema(const Image *,const ChannelType,size_t *,size_t *,
  144. ExceptionInfo *),
  145. GetImageChannelMean(const Image *,const ChannelType,double *,double *,
  146. ExceptionInfo *),
  147. GetImageChannelKurtosis(const Image *,const ChannelType,double *,double *,
  148. ExceptionInfo *),
  149. GetImageChannelRange(const Image *,const ChannelType,double *,double *,
  150. ExceptionInfo *),
  151. GetImageEntropy(const Image *,double *,ExceptionInfo *),
  152. GetImageExtrema(const Image *,size_t *,size_t *,ExceptionInfo *),
  153. GetImageMean(const Image *,double *,double *,ExceptionInfo *),
  154. GetImageKurtosis(const Image *,double *,double *,ExceptionInfo *),
  155. GetImageRange(const Image *,double *,double *,ExceptionInfo *);
  156. #if defined(__cplusplus) || defined(c_plusplus)
  157. }
  158. #endif
  159. #endif