blob: 5917cdc476fa446ca3be816b53a00951f51db00a [file] [log] [blame]
cristy3ed852e2009-09-05 21:47:34 +00001/*
cristyfe676ee2013-11-18 13:03:38 +00002 Copyright 1999-2014 ImageMagick Studio LLC, a non-profit organization
cristy3ed852e2009-09-05 21:47:34 +00003 dedicated to making software imaging solutions freely available.
4
5 You may not use this file except in compliance with the License.
6 obtain a copy of the License at
7
8 http://www.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
cristy3e2860c2010-01-24 01:36:30 +000016 MagickCore statistical methods.
cristy3ed852e2009-09-05 21:47:34 +000017*/
18#ifndef _MAGICKCORE_STATISTIC_H
19#define _MAGICKCORE_STATISTIC_H
20
21#if defined(__cplusplus) || defined(c_plusplus)
22extern "C" {
23#endif
24
25typedef struct _ChannelStatistics
26{
cristybb503372010-05-27 20:51:26 +000027 size_t
cristy3ed852e2009-09-05 21:47:34 +000028 depth;
29
30 double
cristy5048d302012-08-07 01:05:16 +000031 area,
cristy3ed852e2009-09-05 21:47:34 +000032 minima,
33 maxima,
cristyfd9dcd42010-08-08 18:07:02 +000034 sum,
35 sum_squared,
cristya8178ed2010-08-10 17:31:59 +000036 sum_cubed,
37 sum_fourth_power,
cristycf584452010-08-08 02:26:04 +000038 mean,
cristyfd9dcd42010-08-08 18:07:02 +000039 variance,
cristycf584452010-08-08 02:26:04 +000040 standard_deviation,
cristy3ed852e2009-09-05 21:47:34 +000041 kurtosis,
42 skewness;
43} ChannelStatistics;
44
cristybd4a3c22014-01-07 15:09:37 +000045typedef struct _ChannelMoments
46{
47 double
cristy7613ee42014-01-09 01:57:55 +000048 I[32];
cristy89298f32014-01-08 00:21:50 +000049
50 PointInfo
51 centroid,
52 ellipse_axis;
53
54 double
55 ellipse_angle,
56 ellipse_eccentricity,
57 ellipse_intensity;
cristybd4a3c22014-01-07 15:09:37 +000058} ChannelMoments;
59
cristyf8f39d42014-02-22 21:44:38 +000060typedef struct _ChannelPerceptualHash
61{
62 double
63 P[32],
64 Q[32];
65} ChannelPerceptualHash;
66
cristy351842f2010-03-07 15:27:38 +000067typedef enum
68{
69 UndefinedEvaluateOperator,
cristy95f562a2012-01-01 20:49:11 +000070 AbsEvaluateOperator,
cristy351842f2010-03-07 15:27:38 +000071 AddEvaluateOperator,
cristy95f562a2012-01-01 20:49:11 +000072 AddModulusEvaluateOperator,
cristy351842f2010-03-07 15:27:38 +000073 AndEvaluateOperator,
cristy95f562a2012-01-01 20:49:11 +000074 CosineEvaluateOperator,
cristy351842f2010-03-07 15:27:38 +000075 DivideEvaluateOperator,
cristy95f562a2012-01-01 20:49:11 +000076 ExponentialEvaluateOperator,
cristy351842f2010-03-07 15:27:38 +000077 GaussianNoiseEvaluateOperator,
78 ImpulseNoiseEvaluateOperator,
79 LaplacianNoiseEvaluateOperator,
cristy95f562a2012-01-01 20:49:11 +000080 LeftShiftEvaluateOperator,
81 LogEvaluateOperator,
82 MaxEvaluateOperator,
cristy33aaed22010-08-11 18:10:50 +000083 MeanEvaluateOperator,
cristy95f562a2012-01-01 20:49:11 +000084 MedianEvaluateOperator,
85 MinEvaluateOperator,
86 MultiplicativeNoiseEvaluateOperator,
87 MultiplyEvaluateOperator,
88 OrEvaluateOperator,
89 PoissonNoiseEvaluateOperator,
90 PowEvaluateOperator,
91 RightShiftEvaluateOperator,
cristy7c4c78f2014-06-15 21:57:39 +000092 RootMeanSquareEvaluateOperator,
cristy95f562a2012-01-01 20:49:11 +000093 SetEvaluateOperator,
94 SineEvaluateOperator,
95 SubtractEvaluateOperator,
cristy12a3f8e2012-01-31 01:53:19 +000096 SumEvaluateOperator,
cristy95f562a2012-01-01 20:49:11 +000097 ThresholdBlackEvaluateOperator,
98 ThresholdEvaluateOperator,
99 ThresholdWhiteEvaluateOperator,
100 UniformNoiseEvaluateOperator,
101 XorEvaluateOperator
cristy351842f2010-03-07 15:27:38 +0000102} MagickEvaluateOperator;
103
104typedef enum
105{
106 UndefinedFunction,
107 PolynomialFunction,
108 SinusoidFunction,
109 ArcsinFunction,
110 ArctanFunction
111} MagickFunction;
112
cristy99bd5232011-12-07 14:38:20 +0000113typedef enum
114{
115 UndefinedStatistic,
116 GradientStatistic,
117 MaximumStatistic,
118 MeanStatistic,
119 MedianStatistic,
120 MinimumStatistic,
121 ModeStatistic,
122 NonpeakStatistic,
cristy180908c2014-06-15 13:01:43 +0000123 RootMeanSquareStatistic,
cristy99bd5232011-12-07 14:38:20 +0000124 StandardDeviationStatistic
125} StatisticType;
126
cristy3ed852e2009-09-05 21:47:34 +0000127extern MagickExport ChannelStatistics
cristyd42d9952011-07-08 14:21:50 +0000128 *GetImageStatistics(const Image *,ExceptionInfo *);
cristy3ed852e2009-09-05 21:47:34 +0000129
cristybd4a3c22014-01-07 15:09:37 +0000130extern MagickExport ChannelMoments
131 *GetImageMoments(const Image *,ExceptionInfo *);
132
cristyf8f39d42014-02-22 21:44:38 +0000133extern MagickExport ChannelPerceptualHash
cristyb3538ec2014-02-22 23:13:34 +0000134 *GetImagePerceptualHash(const Image *,ExceptionInfo *);
cristyf8f39d42014-02-22 21:44:38 +0000135
cristy316d5172009-09-17 19:31:25 +0000136extern MagickExport Image
cristy99bd5232011-12-07 14:38:20 +0000137 *EvaluateImages(const Image *,const MagickEvaluateOperator,ExceptionInfo *),
cristyf56e6ad2012-11-11 19:29:38 +0000138 *PolynomialImage(const Image *,const size_t,const double *,ExceptionInfo *),
cristy99bd5232011-12-07 14:38:20 +0000139 *StatisticImage(const Image *,const StatisticType,const size_t,const size_t,
140 ExceptionInfo *);
cristy316d5172009-09-17 19:31:25 +0000141
cristy3ed852e2009-09-05 21:47:34 +0000142extern MagickExport MagickBooleanType
cristy351842f2010-03-07 15:27:38 +0000143 EvaluateImage(Image *,const MagickEvaluateOperator,const double,
144 ExceptionInfo *),
cristybb503372010-05-27 20:51:26 +0000145 FunctionImage(Image *,const MagickFunction,const size_t,const double *,
cristy351842f2010-03-07 15:27:38 +0000146 ExceptionInfo *),
cristy5ed838e2010-05-31 00:05:35 +0000147 GetImageExtrema(const Image *,size_t *,size_t *,ExceptionInfo *),
cristy3ed852e2009-09-05 21:47:34 +0000148 GetImageMean(const Image *,double *,double *,ExceptionInfo *),
cristyd42d9952011-07-08 14:21:50 +0000149 GetImageKurtosis(const Image *,double *,double *,ExceptionInfo *),
150 GetImageRange(const Image *,double *,double *,ExceptionInfo *);
cristy3ed852e2009-09-05 21:47:34 +0000151
152#if defined(__cplusplus) || defined(c_plusplus)
153}
154#endif
155
156#endif