# Synopse

Find global image statistics.

• y = iastats(f, measurement)
• y: Double
• f: Image
• measurement: String Choose the measure to compute: 'max', 'min', 'median', 'mean', 'sum', 'std', 'std1'.
```01. from numpy import *
02. from string import upper
03.
04. def iastats(f, measurement):
05.
06.     measurement = upper(measurement)
07.     if measurement == 'MAX':
08.         y = max(ravel(f))
09.     elif measurement == 'MIN':
10.         y = min(ravel(f))
11.     elif measurement == 'MEAN':
12.         y = mean(ravel(f))
13.     elif measurement == 'MEDIAN':
14.         y = median(ravel(f))
15.     elif measurement == 'STD':
16.         y = std(ravel(f),ddof=1)
17.     elif measurement == 'STD1':
18.         y = std(ravel(f))
19.     elif measurement == 'SUM':
20.         y = sum(ravel(f))
21.     else:
22.         assert 0,'Not a valid measurement'
23.
24.
25.     return y```

# Description

Compute global image statistics:

• 'max' - maximum gray-scale value in image;
• 'min' - minimum gray-scale value in image;
• 'sum' - sum of all pixel values;
• 'median' - median value of all pixels in image;
• 'mean' - mean value of all pixels in image;
• 'std' - standard deviation of all pixels (normalized by N-1);
• 'std1' - idem, normalized by N.

# Examples

## Example 1

```01. from ia870 import iastats
02.
03.
04. f=uint8([0,1,2,3,4,5,6])
05. print iastats(f,'min')
06. print iastats(f,'max')
07. print iastats(f,'sum')
08. print iastats(f,'median')
09. print iastats(f,'mean')
10. print iastats(f,'std')
11. print iastats(f,'std1')```
```0
6
21
3.0
3.0
2.16024689947
2.0
```