blob: e3a93a4958ae8e63d282899ae9ef76ec0675c55a [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
cristy3ac6aa92014-09-08 11:48:28 +000025#define MaximumNumberOfImageMoments 8
cristy4cc7ead2014-10-18 14:49:43 +000026#define MaximumNumberOfPerceptualHashes 7
cristy3ac6aa92014-09-08 11:48:28 +000027
cristy3ed852e2009-09-05 21:47:34 +000028typedef struct _ChannelStatistics
29{
cristybb503372010-05-27 20:51:26 +000030 size_t
cristy3ed852e2009-09-05 21:47:34 +000031 depth;
32
33 double
cristy5048d302012-08-07 01:05:16 +000034 area,
cristy3ed852e2009-09-05 21:47:34 +000035 minima,
36 maxima,
cristyfd9dcd42010-08-08 18:07:02 +000037 sum,
38 sum_squared,
cristya8178ed2010-08-10 17:31:59 +000039 sum_cubed,
40 sum_fourth_power,
cristycf584452010-08-08 02:26:04 +000041 mean,
cristyfd9dcd42010-08-08 18:07:02 +000042 variance,
cristycf584452010-08-08 02:26:04 +000043 standard_deviation,
cristy3ed852e2009-09-05 21:47:34 +000044 kurtosis,
cristy81c33602014-11-08 23:42:40 +000045 skewness,
46 entropy;
cristy3ed852e2009-09-05 21:47:34 +000047} ChannelStatistics;
48
cristybd4a3c22014-01-07 15:09:37 +000049typedef struct _ChannelMoments
50{
51 double
cristy57f71282014-10-04 12:32:50 +000052 invariant[MaximumNumberOfImageMoments+1];
cristy89298f32014-01-08 00:21:50 +000053
54 PointInfo
55 centroid,
56 ellipse_axis;
57
58 double
59 ellipse_angle,
60 ellipse_eccentricity,
61 ellipse_intensity;
cristybd4a3c22014-01-07 15:09:37 +000062} ChannelMoments;
63
cristyf8f39d42014-02-22 21:44:38 +000064typedef struct _ChannelPerceptualHash
65{
66 double
cristy3ac6aa92014-09-08 11:48:28 +000067 srgb_hu_phash[MaximumNumberOfImageMoments+1],
68 hclp_hu_phash[MaximumNumberOfImageMoments+1];
cristyf8f39d42014-02-22 21:44:38 +000069} ChannelPerceptualHash;
70
cristy351842f2010-03-07 15:27:38 +000071typedef enum
72{
73 UndefinedEvaluateOperator,
cristy95f562a2012-01-01 20:49:11 +000074 AbsEvaluateOperator,
cristy351842f2010-03-07 15:27:38 +000075 AddEvaluateOperator,
cristy95f562a2012-01-01 20:49:11 +000076 AddModulusEvaluateOperator,
cristy351842f2010-03-07 15:27:38 +000077 AndEvaluateOperator,
cristy95f562a2012-01-01 20:49:11 +000078 CosineEvaluateOperator,
cristy351842f2010-03-07 15:27:38 +000079 DivideEvaluateOperator,
cristy95f562a2012-01-01 20:49:11 +000080 ExponentialEvaluateOperator,
cristy351842f2010-03-07 15:27:38 +000081 GaussianNoiseEvaluateOperator,
82 ImpulseNoiseEvaluateOperator,
83 LaplacianNoiseEvaluateOperator,
cristy95f562a2012-01-01 20:49:11 +000084 LeftShiftEvaluateOperator,
85 LogEvaluateOperator,
86 MaxEvaluateOperator,
cristy33aaed22010-08-11 18:10:50 +000087 MeanEvaluateOperator,
cristy95f562a2012-01-01 20:49:11 +000088 MedianEvaluateOperator,
89 MinEvaluateOperator,
90 MultiplicativeNoiseEvaluateOperator,
91 MultiplyEvaluateOperator,
92 OrEvaluateOperator,
93 PoissonNoiseEvaluateOperator,
94 PowEvaluateOperator,
95 RightShiftEvaluateOperator,
cristy7c4c78f2014-06-15 21:57:39 +000096 RootMeanSquareEvaluateOperator,
cristy95f562a2012-01-01 20:49:11 +000097 SetEvaluateOperator,
98 SineEvaluateOperator,
99 SubtractEvaluateOperator,
cristy12a3f8e2012-01-31 01:53:19 +0000100 SumEvaluateOperator,
cristy95f562a2012-01-01 20:49:11 +0000101 ThresholdBlackEvaluateOperator,
102 ThresholdEvaluateOperator,
103 ThresholdWhiteEvaluateOperator,
104 UniformNoiseEvaluateOperator,
105 XorEvaluateOperator
cristy351842f2010-03-07 15:27:38 +0000106} MagickEvaluateOperator;
107
108typedef enum
109{
110 UndefinedFunction,
111 PolynomialFunction,
112 SinusoidFunction,
113 ArcsinFunction,
114 ArctanFunction
115} MagickFunction;
116
cristy99bd5232011-12-07 14:38:20 +0000117typedef enum
118{
119 UndefinedStatistic,
120 GradientStatistic,
121 MaximumStatistic,
122 MeanStatistic,
123 MedianStatistic,
124 MinimumStatistic,
125 ModeStatistic,
126 NonpeakStatistic,
cristy180908c2014-06-15 13:01:43 +0000127 RootMeanSquareStatistic,
cristy99bd5232011-12-07 14:38:20 +0000128 StandardDeviationStatistic
129} StatisticType;
130
cristy3ed852e2009-09-05 21:47:34 +0000131extern MagickExport ChannelStatistics
cristyd42d9952011-07-08 14:21:50 +0000132 *GetImageStatistics(const Image *,ExceptionInfo *);
cristy3ed852e2009-09-05 21:47:34 +0000133
cristybd4a3c22014-01-07 15:09:37 +0000134extern MagickExport ChannelMoments
135 *GetImageMoments(const Image *,ExceptionInfo *);
136
cristyf8f39d42014-02-22 21:44:38 +0000137extern MagickExport ChannelPerceptualHash
cristyb3538ec2014-02-22 23:13:34 +0000138 *GetImagePerceptualHash(const Image *,ExceptionInfo *);
cristyf8f39d42014-02-22 21:44:38 +0000139
cristy316d5172009-09-17 19:31:25 +0000140extern MagickExport Image
cristy99bd5232011-12-07 14:38:20 +0000141 *EvaluateImages(const Image *,const MagickEvaluateOperator,ExceptionInfo *),
cristyf56e6ad2012-11-11 19:29:38 +0000142 *PolynomialImage(const Image *,const size_t,const double *,ExceptionInfo *),
cristy99bd5232011-12-07 14:38:20 +0000143 *StatisticImage(const Image *,const StatisticType,const size_t,const size_t,
144 ExceptionInfo *);
cristy316d5172009-09-17 19:31:25 +0000145
cristy3ed852e2009-09-05 21:47:34 +0000146extern MagickExport MagickBooleanType
cristy351842f2010-03-07 15:27:38 +0000147 EvaluateImage(Image *,const MagickEvaluateOperator,const double,
148 ExceptionInfo *),
cristybb503372010-05-27 20:51:26 +0000149 FunctionImage(Image *,const MagickFunction,const size_t,const double *,
cristy351842f2010-03-07 15:27:38 +0000150 ExceptionInfo *),
cristy5ed838e2010-05-31 00:05:35 +0000151 GetImageExtrema(const Image *,size_t *,size_t *,ExceptionInfo *),
cristy3ed852e2009-09-05 21:47:34 +0000152 GetImageMean(const Image *,double *,double *,ExceptionInfo *),
cristyd42d9952011-07-08 14:21:50 +0000153 GetImageKurtosis(const Image *,double *,double *,ExceptionInfo *),
154 GetImageRange(const Image *,double *,double *,ExceptionInfo *);
cristy3ed852e2009-09-05 21:47:34 +0000155
156#if defined(__cplusplus) || defined(c_plusplus)
157}
158#endif
159
160#endif