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