[mmpatspec] [Up] [mmglblshow] Measurements

mmstats
Find global image statistics.

Synopsis

y = mmstats( f, measurement )

Implemented in Python.

Input

f Image
measurement String

Choose the measure to compute: 'max', 'min', 'median', 'mean', 'sum', 'std', 'std1'.

Output

y Double

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.

Equation

Source Code

def mmstats(f, measurement):
    from string import upper
    from Numeric import ravel
    from MLab import mean, median, std
    measurement = upper(measurement)
    if measurement == 'MAX':
        y = max(ravel(f))
    elif measurement == 'MIN':
        y = min(ravel(f))
    elif measurement == 'MEAN':
        y = mean(ravel(f))
    elif measurement == 'MEDIAN':
        y = median(ravel(f))
    elif measurement == 'STD':
        y = std(ravel(f))
    else:
        assert 0,'Not a valid measurement'
    return y
    

See also

mmhistogram Find the histogram of the image f.
mmblob Blob measurements from a labeled image.
mmgrain Gray-scale statistics for each labeled region.
[mmpatspec] [Up] [mmglblshow] Python