Home | History | Annotate | Download | only in MagickCore
      1 /*
      2   Copyright 1999-2016 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.
      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 
     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 MaximumNumberOfPerceptualHashes  7
     27 
     28 typedef struct _ChannelStatistics
     29 {
     30   size_t
     31     depth;
     32 
     33   double
     34     area,
     35     minima,
     36     maxima,
     37     sum,
     38     sum_squared,
     39     sum_cubed,
     40     sum_fourth_power,
     41     mean,
     42     variance,
     43     standard_deviation,
     44     kurtosis,
     45     skewness,
     46     entropy;
     47 } ChannelStatistics;
     48 
     49 typedef struct _ChannelMoments
     50 {
     51   double
     52      invariant[MaximumNumberOfImageMoments+1];
     53 
     54   PointInfo
     55     centroid,
     56     ellipse_axis;
     57 
     58   double
     59     ellipse_angle,
     60     ellipse_eccentricity,
     61     ellipse_intensity;
     62 } ChannelMoments;
     63 
     64 typedef struct _ChannelPerceptualHash
     65 {
     66   double
     67     srgb_hu_phash[MaximumNumberOfImageMoments+1],
     68     hclp_hu_phash[MaximumNumberOfImageMoments+1];
     69 } ChannelPerceptualHash;
     70 
     71 typedef enum
     72 {
     73   UndefinedEvaluateOperator,
     74   AbsEvaluateOperator,
     75   AddEvaluateOperator,
     76   AddModulusEvaluateOperator,
     77   AndEvaluateOperator,
     78   CosineEvaluateOperator,
     79   DivideEvaluateOperator,
     80   ExponentialEvaluateOperator,
     81   GaussianNoiseEvaluateOperator,
     82   ImpulseNoiseEvaluateOperator,
     83   LaplacianNoiseEvaluateOperator,
     84   LeftShiftEvaluateOperator,
     85   LogEvaluateOperator,
     86   MaxEvaluateOperator,
     87   MeanEvaluateOperator,
     88   MedianEvaluateOperator,
     89   MinEvaluateOperator,
     90   MultiplicativeNoiseEvaluateOperator,
     91   MultiplyEvaluateOperator,
     92   OrEvaluateOperator,
     93   PoissonNoiseEvaluateOperator,
     94   PowEvaluateOperator,
     95   RightShiftEvaluateOperator,
     96   RootMeanSquareEvaluateOperator,
     97   SetEvaluateOperator,
     98   SineEvaluateOperator,
     99   SubtractEvaluateOperator,
    100   SumEvaluateOperator,
    101   ThresholdBlackEvaluateOperator,
    102   ThresholdEvaluateOperator,
    103   ThresholdWhiteEvaluateOperator,
    104   UniformNoiseEvaluateOperator,
    105   XorEvaluateOperator
    106 } MagickEvaluateOperator;
    107 
    108 typedef enum
    109 {
    110   UndefinedFunction,
    111   ArcsinFunction,
    112   ArctanFunction,
    113   PolynomialFunction,
    114   SinusoidFunction
    115 } MagickFunction;
    116 
    117 typedef enum
    118 {
    119   UndefinedStatistic,
    120   GradientStatistic,
    121   MaximumStatistic,
    122   MeanStatistic,
    123   MedianStatistic,
    124   MinimumStatistic,
    125   ModeStatistic,
    126   NonpeakStatistic,
    127   RootMeanSquareStatistic,
    128   StandardDeviationStatistic
    129 } StatisticType;
    130 
    131 extern MagickExport ChannelStatistics
    132   *GetImageStatistics(const Image *,ExceptionInfo *);
    133 
    134 extern MagickExport ChannelMoments
    135   *GetImageMoments(const Image *,ExceptionInfo *);
    136 
    137 extern MagickExport ChannelPerceptualHash
    138   *GetImagePerceptualHash(const Image *,ExceptionInfo *);
    139 
    140 extern MagickExport Image
    141   *EvaluateImages(const Image *,const MagickEvaluateOperator,ExceptionInfo *),
    142   *PolynomialImage(const Image *,const size_t,const double *,ExceptionInfo *),
    143   *StatisticImage(const Image *,const StatisticType,const size_t,const size_t,
    144     ExceptionInfo *);
    145 
    146 extern MagickExport MagickBooleanType
    147   EvaluateImage(Image *,const MagickEvaluateOperator,const double,
    148     ExceptionInfo *),
    149   FunctionImage(Image *,const MagickFunction,const size_t,const double *,
    150     ExceptionInfo *),
    151   GetImageEntropy(const Image *,double *,ExceptionInfo *),
    152   GetImageExtrema(const Image *,size_t *,size_t *,ExceptionInfo *),
    153   GetImageMean(const Image *,double *,double *,ExceptionInfo *),
    154   GetImageKurtosis(const Image *,double *,double *,ExceptionInfo *),
    155   GetImageRange(const Image *,double *,double *,ExceptionInfo *);
    156 
    157 #if defined(__cplusplus) || defined(c_plusplus)
    158 }
    159 #endif
    160 
    161 #endif
    162