Home | History | Annotate | Download | only in api
      1 
      2 
      3 
      4 
      5 <!DOCTYPE html>
      6 <html lang="en">
      7 <head>
      8     <title>ImageMagick: MagickCore, C API for ImageMagick: Image Statistics</title>
      9   <meta charset="utf-8" />
     10   <meta http-equiv="X-UA-Compatible" content="IE=edge" />
     11   <meta name="viewport" content="width=device-width, initial-scale=1" />
     12   <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
     13   <meta name="application-name" content="ImageMagick"/>
     14   <meta name="description" content="ImageMagick is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, JPEG-2000, GIF, WebP, Postscript, PDF, and SVG. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bzier curves."/>
     15   <meta name="application-url" content="http://www.imagemagick.org"/>
     16   <meta name="generator" content="PHP"/>
     17   <meta name="keywords" content="magickcore, c, api, for, imagemagick:, image, statistics, ImageMagick, PerlMagick, image processing, image, photo, software, Magick++, OpenMP, convert"/>
     18   <meta name="rating" content="GENERAL"/>
     19   <meta name="robots" content="INDEX, FOLLOW"/>
     20   <meta name="generator" content="ImageMagick Studio LLC"/>
     21   <meta name="author" content="ImageMagick Studio LLC"/>
     22   <meta name="revisit-after" content="2 DAYS"/>
     23   <meta name="resource-type" content="document"/>
     24   <meta name="copyright" content="Copyright (c) 1999-2016 ImageMagick Studio LLC"/>
     25   <meta name="distribution" content="Global"/>
     26   <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1"/>
     27   <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" />
     28   <link rel="icon" href="../images/wand.png"/>
     29   <link rel="shortcut icon" href="../images/wand.ico"/>
     30   <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:900,400,400italic,700,700italic,300,300italic|Open+Sans:300italic,400italic,700italic,300,400,600,700">
     31   <link rel="stylesheet" href="../css/magick.html"/>
     32 </head>
     33 <body>
     34 <div class="main">
     35 <div class="magick-masthead">
     36   <div class="container">
     37     <script async="async" src="http://localhost/pagead/js/adsbygoogle.js"></script>    <ins class="adsbygoogle"
     38          style="display:block"
     39          data-ad-client="ca-pub-3129977114552745"
     40          data-ad-slot="6345125851"
     41          data-ad-format="auto"></ins>
     42     <script>
     43       (adsbygoogle = window.adsbygoogle || []).push({});
     44     </script>
     45     <nav class="magick-nav">
     46       <a class="magick-nav-item " href="../index.html">Home</a>
     47       <a class="magick-nav-item " href="../binary-releases.html">Download</a>
     48       <a class="magick-nav-item " href="../command-line-tools.html">Tools</a>
     49       <a class="magick-nav-item " href="../command-line-processing.html">Command-line</a>
     50       <a class="magick-nav-item " href="../resources.html">Resources</a>
     51       <a class="magick-nav-item " href="api.html">Develop</a>
     52       <a class="magick-nav-item " href="http://www.imagemagick.org/script/search.php">Search</a>
     53       <a class="magick-nav-item pull-right" href="https://www.imagemagick.org/discourse-server/">Community</a>
     54     </nav>
     55   </div>
     56 </div>
     57 <div class="container">
     58 <div class="magick-header">
     59 <p class="text-center"><a href="statistic.html#EvaluateImage">EvaluateImage</a> &#8226; <a href="statistic.html#FunctionImage">FunctionImage</a> &#8226; <a href="statistic.html#GetImageEntropy">GetImageEntropy</a> &#8226; <a href="statistic.html#GetImageExtrema">GetImageExtrema</a> &#8226; <a href="statistic.html#GetImageKurtosis">GetImageKurtosis</a> &#8226; <a href="statistic.html#GetImageMean">GetImageMean</a> &#8226; <a href="statistic.html#GetImageMoments">GetImageMoments</a> &#8226; <a href="statistic.html#GetImagePerceptualHash">GetImagePerceptualHash</a> &#8226; <a href="statistic.html#GetImageRange">GetImageRange</a> &#8226; <a href="statistic.html#GetImageStatistics">GetImageStatistics</a> &#8226; <a href="statistic.html#PolynomialImage">PolynomialImage</a> &#8226; <a href="statistic.html#StatisticImage">StatisticImage</a></p>
     60 
     61 <h2><a href="http://www.imagemagick.org/api/MagickCore/statistic_8c.html" id="EvaluateImage">EvaluateImage</a></h2>
     62 
     63 <p>EvaluateImage() applies a value to the image with an arithmetic, relational, or logical operator to an image. Use these operations to lighten or darken an image, to increase or decrease contrast in an image, or to produce the "negative" of an image.</p>
     64 
     65 <p>The format of the EvaluateImage method is:</p>
     66 
     67 <pre class="text">
     68 MagickBooleanType EvaluateImage(Image *image,
     69   const MagickEvaluateOperator op,const double value,
     70   ExceptionInfo *exception)
     71 MagickBooleanType EvaluateImages(Image *images,
     72   const MagickEvaluateOperator op,const double value,
     73   ExceptionInfo *exception)
     74 </pre>
     75 
     76 <p>A description of each parameter follows:</p>
     77 
     78 <dd>
     79 </dd>
     80 
     81 <dd> </dd>
     82 <dl class="dl-horizontal">
     83 <dt>image</dt>
     84 <dd>the image. </dd>
     85 
     86 <dd> </dd>
     87 <dt>op</dt>
     88 <dd>A channel op. </dd>
     89 
     90 <dd> </dd>
     91 <dt>value</dt>
     92 <dd>A value value. </dd>
     93 
     94 <dd> </dd>
     95 <dt>exception</dt>
     96 <dd>return any errors or warnings in this structure. </dd>
     97 
     98 <dd>  </dd>
     99 </dl>
    100 <h2><a href="http://www.imagemagick.org/api/MagickCore/statistic_8c.html" id="FunctionImage">FunctionImage</a></h2>
    101 
    102 <p>FunctionImage() applies a value to the image with an arithmetic, relational, or logical operator to an image. Use these operations to lighten or darken an image, to increase or decrease contrast in an image, or to produce the "negative" of an image.</p>
    103 
    104 <p>The format of the FunctionImage method is:</p>
    105 
    106 <pre class="text">
    107 MagickBooleanType FunctionImage(Image *image,
    108   const MagickFunction function,const ssize_t number_parameters,
    109   const double *parameters,ExceptionInfo *exception)
    110 </pre>
    111 
    112 <p>A description of each parameter follows:</p>
    113 
    114 <dd>
    115 </dd>
    116 
    117 <dd> </dd>
    118 <dl class="dl-horizontal">
    119 <dt>image</dt>
    120 <dd>the image. </dd>
    121 
    122 <dd> </dd>
    123 <dt>function</dt>
    124 <dd>A channel function. </dd>
    125 
    126 <dd> </dd>
    127 <dt>parameters</dt>
    128 <dd>one or more parameters. </dd>
    129 
    130 <dd> </dd>
    131 <dt>exception</dt>
    132 <dd>return any errors or warnings in this structure. </dd>
    133 
    134 <dd>  </dd>
    135 </dl>
    136 <h2><a href="http://www.imagemagick.org/api/MagickCore/statistic_8c.html" id="GetImageEntropy">GetImageEntropy</a></h2>
    137 
    138 <p>GetImageEntropy() returns the entropy of one or more image channels.</p>
    139 
    140 <p>The format of the GetImageEntropy method is:</p>
    141 
    142 <pre class="text">
    143 MagickBooleanType GetImageEntropy(const Image *image,double *entropy,
    144   ExceptionInfo *exception)
    145 </pre>
    146 
    147 <p>A description of each parameter follows:</p>
    148 
    149 <dd>
    150 </dd>
    151 
    152 <dd> </dd>
    153 <dl class="dl-horizontal">
    154 <dt>image</dt>
    155 <dd>the image. </dd>
    156 
    157 <dd> </dd>
    158 <dt>entropy</dt>
    159 <dd>the average entropy of the selected channels. </dd>
    160 
    161 <dd> </dd>
    162 <dt>exception</dt>
    163 <dd>return any errors or warnings in this structure. </dd>
    164 
    165 <dd>  </dd>
    166 </dl>
    167 <h2><a href="http://www.imagemagick.org/api/MagickCore/statistic_8c.html" id="GetImageExtrema">GetImageExtrema</a></h2>
    168 
    169 <p>GetImageExtrema() returns the extrema of one or more image channels.</p>
    170 
    171 <p>The format of the GetImageExtrema method is:</p>
    172 
    173 <pre class="text">
    174 MagickBooleanType GetImageExtrema(const Image *image,size_t *minima,
    175   size_t *maxima,ExceptionInfo *exception)
    176 </pre>
    177 
    178 <p>A description of each parameter follows:</p>
    179 
    180 <dd>
    181 </dd>
    182 
    183 <dd> </dd>
    184 <dl class="dl-horizontal">
    185 <dt>image</dt>
    186 <dd>the image. </dd>
    187 
    188 <dd> </dd>
    189 <dt>minima</dt>
    190 <dd>the minimum value in the channel. </dd>
    191 
    192 <dd> </dd>
    193 <dt>maxima</dt>
    194 <dd>the maximum value in the channel. </dd>
    195 
    196 <dd> </dd>
    197 <dt>exception</dt>
    198 <dd>return any errors or warnings in this structure. </dd>
    199 
    200 <dd>  </dd>
    201 </dl>
    202 <h2><a href="http://www.imagemagick.org/api/MagickCore/statistic_8c.html" id="GetImageKurtosis">GetImageKurtosis</a></h2>
    203 
    204 <p>GetImageKurtosis() returns the kurtosis and skewness of one or more image channels.</p>
    205 
    206 <p>The format of the GetImageKurtosis method is:</p>
    207 
    208 <pre class="text">
    209 MagickBooleanType GetImageKurtosis(const Image *image,double *kurtosis,
    210   double *skewness,ExceptionInfo *exception)
    211 </pre>
    212 
    213 <p>A description of each parameter follows:</p>
    214 
    215 <dd>
    216 </dd>
    217 
    218 <dd> </dd>
    219 <dl class="dl-horizontal">
    220 <dt>image</dt>
    221 <dd>the image. </dd>
    222 
    223 <dd> </dd>
    224 <dt>kurtosis</dt>
    225 <dd>the kurtosis of the channel. </dd>
    226 
    227 <dd> </dd>
    228 <dt>skewness</dt>
    229 <dd>the skewness of the channel. </dd>
    230 
    231 <dd> </dd>
    232 <dt>exception</dt>
    233 <dd>return any errors or warnings in this structure. </dd>
    234 
    235 <dd>  </dd>
    236 </dl>
    237 <h2><a href="http://www.imagemagick.org/api/MagickCore/statistic_8c.html" id="GetImageMean">GetImageMean</a></h2>
    238 
    239 <p>GetImageMean() returns the mean and standard deviation of one or more image channels.</p>
    240 
    241 <p>The format of the GetImageMean method is:</p>
    242 
    243 <pre class="text">
    244 MagickBooleanType GetImageMean(const Image *image,double *mean,
    245   double *standard_deviation,ExceptionInfo *exception)
    246 </pre>
    247 
    248 <p>A description of each parameter follows:</p>
    249 
    250 <dd>
    251 </dd>
    252 
    253 <dd> </dd>
    254 <dl class="dl-horizontal">
    255 <dt>image</dt>
    256 <dd>the image. </dd>
    257 
    258 <dd> </dd>
    259 <dt>mean</dt>
    260 <dd>the average value in the channel. </dd>
    261 
    262 <dd> </dd>
    263 <dt>standard_deviation</dt>
    264 <dd>the standard deviation of the channel. </dd>
    265 
    266 <dd> </dd>
    267 <dt>exception</dt>
    268 <dd>return any errors or warnings in this structure. </dd>
    269 
    270 <dd>  </dd>
    271 </dl>
    272 <h2><a href="http://www.imagemagick.org/api/MagickCore/statistic_8c.html" id="GetImageMoments">GetImageMoments</a></h2>
    273 
    274 <p>GetImageMoments() returns the normalized moments of one or more image channels.</p>
    275 
    276 <p>The format of the GetImageMoments method is:</p>
    277 
    278 <pre class="text">
    279 ChannelMoments *GetImageMoments(const Image *image,
    280   ExceptionInfo *exception)
    281 </pre>
    282 
    283 <p>A description of each parameter follows:</p>
    284 
    285 <dd>
    286 </dd>
    287 
    288 <dd> </dd>
    289 <dl class="dl-horizontal">
    290 <dt>image</dt>
    291 <dd>the image. </dd>
    292 
    293 <dd> </dd>
    294 <dt>exception</dt>
    295 <dd>return any errors or warnings in this structure. </dd>
    296 
    297 <dd>  </dd>
    298 </dl>
    299 <h2><a href="http://www.imagemagick.org/api/MagickCore/statistic_8c.html" id="GetImagePerceptualHash">GetImagePerceptualHash</a></h2>
    300 
    301 <p>GetImagePerceptualHash() returns the perceptual hash of one or more image channels.</p>
    302 
    303 <p>The format of the GetImagePerceptualHash method is:</p>
    304 
    305 <pre class="text">
    306 ChannelPerceptualHash *GetImagePerceptualHash(const Image *image,
    307   ExceptionInfo *exception)
    308 </pre>
    309 
    310 <p>A description of each parameter follows:</p>
    311 
    312 <dd>
    313 </dd>
    314 
    315 <dd> </dd>
    316 <dl class="dl-horizontal">
    317 <dt>image</dt>
    318 <dd>the image. </dd>
    319 
    320 <dd> </dd>
    321 <dt>exception</dt>
    322 <dd>return any errors or warnings in this structure. </dd>
    323 
    324 <dd>  </dd>
    325 </dl>
    326 <h2><a href="http://www.imagemagick.org/api/MagickCore/statistic_8c.html" id="GetImageRange">GetImageRange</a></h2>
    327 
    328 <p>GetImageRange() returns the range of one or more image channels.</p>
    329 
    330 <p>The format of the GetImageRange method is:</p>
    331 
    332 <pre class="text">
    333 MagickBooleanType GetImageRange(const Image *image,double *minima,
    334   double *maxima,ExceptionInfo *exception)
    335 </pre>
    336 
    337 <p>A description of each parameter follows:</p>
    338 
    339 <dd>
    340 </dd>
    341 
    342 <dd> </dd>
    343 <dl class="dl-horizontal">
    344 <dt>image</dt>
    345 <dd>the image. </dd>
    346 
    347 <dd> </dd>
    348 <dt>minima</dt>
    349 <dd>the minimum value in the channel. </dd>
    350 
    351 <dd> </dd>
    352 <dt>maxima</dt>
    353 <dd>the maximum value in the channel. </dd>
    354 
    355 <dd> </dd>
    356 <dt>exception</dt>
    357 <dd>return any errors or warnings in this structure. </dd>
    358 
    359 <dd>  </dd>
    360 </dl>
    361 <h2><a href="http://www.imagemagick.org/api/MagickCore/statistic_8c.html" id="GetImageStatistics">GetImageStatistics</a></h2>
    362 
    363 <p>GetImageStatistics() returns statistics for each channel in the image.  The statistics include the channel depth, its minima, maxima, mean, standard deviation, kurtosis and skewness.  You can access the red channel mean, for example, like this:</p>
    364 
    365 <pre class="text">
    366 channel_statistics=GetImageStatistics(image,exception);
    367 red_mean=channel_statistics[RedPixelChannel].mean;
    368 </pre>
    369 
    370 <p>Use MagickRelinquishMemory() to free the statistics buffer.</p>
    371 
    372 <p>The format of the GetImageStatistics method is:</p>
    373 
    374 <pre class="text">
    375 ChannelStatistics *GetImageStatistics(const Image *image,
    376   ExceptionInfo *exception)
    377 </pre>
    378 
    379 <p>A description of each parameter follows:</p>
    380 
    381 <dd>
    382 </dd>
    383 
    384 <dd> </dd>
    385 <dl class="dl-horizontal">
    386 <dt>image</dt>
    387 <dd>the image. </dd>
    388 
    389 <dd> </dd>
    390 <dt>exception</dt>
    391 <dd>return any errors or warnings in this structure. </dd>
    392 
    393 <dd>  </dd>
    394 </dl>
    395 <h2><a href="http://www.imagemagick.org/api/MagickCore/statistic_8c.html" id="PolynomialImage">PolynomialImage</a></h2>
    396 
    397 <p>PolynomialImage() returns a new image where each pixel is the sum of the pixels in the image sequence after applying its corresponding terms (coefficient and degree pairs).</p>
    398 
    399 <p>The format of the PolynomialImage method is:</p>
    400 
    401 <pre class="text">
    402 Image *PolynomialImage(const Image *images,const size_t number_terms,
    403   const double *terms,ExceptionInfo *exception)
    404 </pre>
    405 
    406 <p>A description of each parameter follows:</p>
    407 
    408 <dd>
    409 </dd>
    410 
    411 <dd> </dd>
    412 <dl class="dl-horizontal">
    413 <dt>images</dt>
    414 <dd>the image sequence. </dd>
    415 
    416 <dd> </dd>
    417 <dt>number_terms</dt>
    418 <dd>the number of terms in the list.  The actual list length is 2 x number_terms + 1 (the constant). </dd>
    419 
    420 <dd> </dd>
    421 <dt>terms</dt>
    422 <dd>the list of polynomial coefficients and degree pairs and a constant. </dd>
    423 
    424 <dd> </dd>
    425 <dt>exception</dt>
    426 <dd>return any errors or warnings in this structure. </dd>
    427 
    428 <dd>  </dd>
    429 </dl>
    430 <h2><a href="http://www.imagemagick.org/api/MagickCore/statistic_8c.html" id="StatisticImage">StatisticImage</a></h2>
    431 
    432 <p>StatisticImage() makes each pixel the min / max / median / mode / etc. of the neighborhood of the specified width and height.</p>
    433 
    434 <p>The format of the StatisticImage method is:</p>
    435 
    436 <pre class="text">
    437 Image *StatisticImage(const Image *image,const StatisticType type,
    438   const size_t width,const size_t height,ExceptionInfo *exception)
    439 </pre>
    440 
    441 <p>A description of each parameter follows:</p>
    442 
    443 <dd>
    444 </dd>
    445 
    446 <dd> </dd>
    447 <dl class="dl-horizontal">
    448 <dt>image</dt>
    449 <dd>the image. </dd>
    450 
    451 <dd> </dd>
    452 <dt>type</dt>
    453 <dd>the statistic type (median, mode, etc.). </dd>
    454 
    455 <dd> </dd>
    456 <dt>width</dt>
    457 <dd>the width of the pixel neighborhood. </dd>
    458 
    459 <dd> </dd>
    460 <dt>height</dt>
    461 <dd>the height of the pixel neighborhood. </dd>
    462 
    463 <dd> </dd>
    464 <dt>exception</dt>
    465 <dd>return any errors or warnings in this structure. </dd>
    466 
    467 <dd>  </dd>
    468 </dl>
    469 </div>
    470   <footer class="magick-footer">
    471     <p><a href="../support.html">Donate</a> 
    472      <a href="../sitemap.html">Sitemap</a> 
    473     <a href="../links.html">Related</a> 
    474     <a href="../architecture.html">Architecture</a>
    475 </p>
    476     <p><a href="statistic.html#">Back to top</a> 
    477     <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> 
    478     <a href="http://www.imagemagick.org/script/contact.php">Contact Us</a></p>
    479         <p><small>  1999-2016 ImageMagick Studio LLC</small></p>
    480   </footer>
    481 </div><!-- /.container -->
    482 
    483   <script src="https://localhost/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    484   <script src="../js/magick.html"></script>
    485 </div>
    486 </body>
    487 </html>
    488