[iaotsu] [Up] [iastat] Measurements

iahistogram
Image histogram.

Synopsis

h = iahistogram( f )

Implemented in Python.

Input

f Image. Gray-scale (uint8 or uint16) or binary image (logical).

Output

h Image. Gray-scale (uint8 or uint16) or binary image (logical).

Examples

>>> f = iaread('woodlog.pgm')

              
>>> iashow(f)
(256, 256) Min= 0 Max= 255 Mean=91.026 Std=53.61
>>> h = iahistogram(f)

              
>>> g,d = iaplot(h)
>>> g('set data style boxes')

              
>>> g.plot(d)
>>> 
f h
d

Equation

Source Code

def iahistogram(f):
    from Numeric import asarray, searchsorted, sort, ravel, concatenate, product
    f = asarray(f)
    n = searchsorted(sort(ravel(f)), range(max(ravel(f))+1))
    n = concatenate([n, [product(f.shape)]])
    h = n[1:]-n[:-1]
    return h
    
[iaotsu] [Up] [iastat] http://www.python.org