imtools.normalize

imtools.normalize(I, a=0, b=1)[source]

Re-scale a NumPy ndarray

Parameters:

I: NumPy ndarray

Array to be normalized

a : float

The lower normalization bound. By default a = 0 (a has to satisfy a < b)

b : float

The upper normalization bound. By default b = 1 (b has to satisfy b < a)

Returns:

In : NumPy ndarray

Scaled version of the input array I, such that a = In.min() and b = In.max()

Examples

>>> I = array([[-1,.2],[100,0]])
>>> In = normalize(I,a=-10,b=12)
>>> In 
    array([[-10.        ,  -9.73861386],
           [ 12.        , -10.        ]])