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