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 #define MaximumNumberOfImageMoments 8 26 #define MaximumNumberOfPerceptualColorspaces 6 27 #define MaximumNumberOfPerceptualHashes 7 28 29 typedef struct _ChannelStatistics 30 { 31 size_t 32 depth; 33 34 double 35 area, 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 median; 49 } ChannelStatistics; 50 51 typedef struct _ChannelMoments 52 { 53 double 54 invariant[MaximumNumberOfImageMoments+1]; 55 56 PointInfo 57 centroid, 58 ellipse_axis; 59 60 double 61 ellipse_angle, 62 ellipse_eccentricity, 63 ellipse_intensity; 64 } ChannelMoments; 65 66 typedef struct _ChannelPerceptualHash 67 { 68 double 69 srgb_hu_phash[MaximumNumberOfImageMoments+1], 70 hclp_hu_phash[MaximumNumberOfImageMoments+1]; 71 72 size_t 73 number_colorspaces; 74 75 ColorspaceType 76 colorspace[MaximumNumberOfPerceptualColorspaces+1]; 77 78 double 79 phash[MaximumNumberOfPerceptualColorspaces+1][MaximumNumberOfImageMoments+1]; 80 81 size_t 82 number_channels; 83 } ChannelPerceptualHash; 84 85 typedef enum 86 { 87 UndefinedEvaluateOperator, 88 AbsEvaluateOperator, 89 AddEvaluateOperator, 90 AddModulusEvaluateOperator, 91 AndEvaluateOperator, 92 CosineEvaluateOperator, 93 DivideEvaluateOperator, 94 ExponentialEvaluateOperator, 95 GaussianNoiseEvaluateOperator, 96 ImpulseNoiseEvaluateOperator, 97 LaplacianNoiseEvaluateOperator, 98 LeftShiftEvaluateOperator, 99 LogEvaluateOperator, 100 MaxEvaluateOperator, 101 MeanEvaluateOperator, 102 MedianEvaluateOperator, 103 MinEvaluateOperator, 104 MultiplicativeNoiseEvaluateOperator, 105 MultiplyEvaluateOperator, 106 OrEvaluateOperator, 107 PoissonNoiseEvaluateOperator, 108 PowEvaluateOperator, 109 RightShiftEvaluateOperator, 110 RootMeanSquareEvaluateOperator, 111 SetEvaluateOperator, 112 SineEvaluateOperator, 113 SubtractEvaluateOperator, 114 SumEvaluateOperator, 115 ThresholdBlackEvaluateOperator, 116 ThresholdEvaluateOperator, 117 ThresholdWhiteEvaluateOperator, 118 UniformNoiseEvaluateOperator, 119 XorEvaluateOperator, 120 InverseLogEvaluateOperator 121 } MagickEvaluateOperator; 122 123 typedef enum 124 { 125 UndefinedFunction, 126 ArcsinFunction, 127 ArctanFunction, 128 PolynomialFunction, 129 SinusoidFunction 130 } MagickFunction; 131 132 typedef enum 133 { 134 UndefinedStatistic, 135 GradientStatistic, 136 MaximumStatistic, 137 MeanStatistic, 138 MedianStatistic, 139 MinimumStatistic, 140 ModeStatistic, 141 NonpeakStatistic, 142 RootMeanSquareStatistic, 143 StandardDeviationStatistic, 144 ContrastStatistic 145 } StatisticType; 146 147 extern MagickExport ChannelStatistics 148 *GetImageStatistics(const Image *,ExceptionInfo *); 149 150 extern MagickExport ChannelMoments 151 *GetImageMoments(const Image *,ExceptionInfo *); 152 153 extern MagickExport ChannelPerceptualHash 154 *GetImagePerceptualHash(const Image *,ExceptionInfo *); 155 156 extern MagickExport Image 157 *EvaluateImages(const Image *,const MagickEvaluateOperator,ExceptionInfo *), 158 *PolynomialImage(const Image *,const size_t,const double *,ExceptionInfo *), 159 *StatisticImage(const Image *,const StatisticType,const size_t,const size_t, 160 ExceptionInfo *); 161 162 extern MagickExport MagickBooleanType 163 EvaluateImage(Image *,const MagickEvaluateOperator,const double, 164 ExceptionInfo *), 165 FunctionImage(Image *,const MagickFunction,const size_t,const double *, 166 ExceptionInfo *), 167 GetImageEntropy(const Image *,double *,ExceptionInfo *), 168 GetImageExtrema(const Image *,size_t *,size_t *,ExceptionInfo *), 169 GetImageMean(const Image *,double *,double *,ExceptionInfo *), 170 GetImageMedian(const Image *,double *,ExceptionInfo *), 171 GetImageKurtosis(const Image *,double *,double *,ExceptionInfo *), 172 GetImageRange(const Image *,double *,double *,ExceptionInfo *); 173 174 #if defined(__cplusplus) || defined(c_plusplus) 175 } 176 #endif 177 178 #endif 179