1 /* 2 Copyright 1999-2021 ImageMagick Studio LLC, a non-profit organization 3 dedicated to making software imaging solutions freely available. 4 5 You may not use this file except in compliance with the License. You may 6 obtain a copy of the License at 7 8 https://imagemagick.org/script/license.php 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 16 MagickCore statistical methods. 17 */ 18 #ifndef MAGICKCORE_STATISTIC_H 19 #define MAGICKCORE_STATISTIC_H 20 21 #if defined(__cplusplus) || defined(c_plusplus) 22 extern "C" { 23 #endif 24 25 #include "magick/draw.h" 26 27 #define MaximumNumberOfImageMoments 8 28 #define MaximumNumberOfPerceptualHashes 7 29 30 typedef struct _ChannelStatistics 31 { 32 size_t 33 depth; 34 35 double 36 minima, 37 maxima, 38 sum, 39 sum_squared, 40 sum_cubed, 41 sum_fourth_power, 42 mean, 43 variance, 44 standard_deviation, 45 kurtosis, 46 skewness, 47 entropy; 48 } ChannelStatistics; 49 50 #undef I 51 52 typedef struct _ChannelMoments 53 { 54 double 55 I[32]; 56 57 PointInfo 58 centroid, 59 ellipse_axis; 60 61 double 62 ellipse_angle, 63 ellipse_eccentricity, 64 ellipse_intensity; 65 } ChannelMoments; 66 67 typedef struct _ChannelPerceptualHash 68 { 69 double 70 P[32], 71 Q[32]; 72 } ChannelPerceptualHash; 73 74 typedef enum 75 { 76 UndefinedEvaluateOperator, 77 AddEvaluateOperator, 78 AndEvaluateOperator, 79 DivideEvaluateOperator, 80 LeftShiftEvaluateOperator, 81 MaxEvaluateOperator, 82 MinEvaluateOperator, 83 MultiplyEvaluateOperator, 84 OrEvaluateOperator, 85 RightShiftEvaluateOperator, 86 SetEvaluateOperator, 87 SubtractEvaluateOperator, 88 XorEvaluateOperator, 89 PowEvaluateOperator, 90 LogEvaluateOperator, 91 ThresholdEvaluateOperator, 92 ThresholdBlackEvaluateOperator, 93 ThresholdWhiteEvaluateOperator, 94 GaussianNoiseEvaluateOperator, 95 ImpulseNoiseEvaluateOperator, 96 LaplacianNoiseEvaluateOperator, 97 MultiplicativeNoiseEvaluateOperator, 98 PoissonNoiseEvaluateOperator, 99 UniformNoiseEvaluateOperator, 100 CosineEvaluateOperator, 101 SineEvaluateOperator, 102 AddModulusEvaluateOperator, 103 MeanEvaluateOperator, 104 AbsEvaluateOperator, 105 ExponentialEvaluateOperator, 106 MedianEvaluateOperator, 107 SumEvaluateOperator, 108 RootMeanSquareEvaluateOperator, 109 InverseLogEvaluateOperator 110 } MagickEvaluateOperator; 111 112 typedef enum 113 { 114 UndefinedFunction, 115 PolynomialFunction, 116 SinusoidFunction, 117 ArcsinFunction, 118 ArctanFunction 119 } MagickFunction; 120 121 typedef enum 122 { 123 UndefinedStatistic, 124 GradientStatistic, 125 MaximumStatistic, 126 MeanStatistic, 127 MedianStatistic, 128 MinimumStatistic, 129 ModeStatistic, 130 NonpeakStatistic, 131 StandardDeviationStatistic, 132 RootMeanSquareStatistic 133 } StatisticType; 134 135 extern MagickExport ChannelStatistics 136 *GetImageChannelStatistics(const Image *,ExceptionInfo *); 137 138 extern MagickExport ChannelMoments 139 *GetImageChannelMoments(const Image *,ExceptionInfo *); 140 141 extern MagickExport ChannelPerceptualHash 142 *GetImageChannelPerceptualHash(const Image *,ExceptionInfo *); 143 144 extern MagickExport Image 145 *EvaluateImages(const Image *,const MagickEvaluateOperator,ExceptionInfo *), 146 *PolynomialImage(const Image *,const size_t,const double *,ExceptionInfo *), 147 *PolynomialImageChannel(const Image *,const ChannelType,const size_t, 148 const double *,ExceptionInfo *), 149 *StatisticImage(const Image *,const StatisticType,const size_t,const size_t, 150 ExceptionInfo *), 151 *StatisticImageChannel(const Image *,const ChannelType,const StatisticType, 152 const size_t,const size_t,ExceptionInfo *); 153 154 extern MagickExport MagickBooleanType 155 EvaluateImage(Image *,const MagickEvaluateOperator,const double, 156 ExceptionInfo *), 157 EvaluateImageChannel(Image *,const ChannelType,const MagickEvaluateOperator, 158 const double,ExceptionInfo *), 159 FunctionImage(Image *,const MagickFunction,const size_t,const double *, 160 ExceptionInfo *), 161 FunctionImageChannel(Image *,const ChannelType,const MagickFunction, 162 const size_t,const double *,ExceptionInfo *), 163 GetImageChannelEntropy(const Image *,const ChannelType,double *, 164 ExceptionInfo *), 165 GetImageChannelExtrema(const Image *,const ChannelType,size_t *,size_t *, 166 ExceptionInfo *), 167 GetImageChannelMean(const Image *,const ChannelType,double *,double *, 168 ExceptionInfo *), 169 GetImageChannelKurtosis(const Image *,const ChannelType,double *,double *, 170 ExceptionInfo *), 171 GetImageChannelRange(const Image *,const ChannelType,double *,double *, 172 ExceptionInfo *), 173 GetImageEntropy(const Image *,double *,ExceptionInfo *), 174 GetImageExtrema(const Image *,size_t *,size_t *,ExceptionInfo *), 175 GetImageMean(const Image *,double *,double *,ExceptionInfo *), 176 GetImageKurtosis(const Image *,double *,double *,ExceptionInfo *), 177 GetImageRange(const Image *,double *,double *,ExceptionInfo *); 178 179 #if defined(__cplusplus) || defined(c_plusplus) 180 } 181 #endif 182 183 #endif 184