[mmconcat] [Up] [mmmaxleveltype] Image Information and Manipulation

mmlimits
Get the possible minimum and maximum of an image.

Synopsis

y = mmlimits( f )

Implemented in Python.

Input

f Image Unsigned gray-scale (uint8 or uint16), signed (int32) or binary image.

Output

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

Vector, the first element is the infimum, the second, the supremum.

Description

The minimum (infimum) and maximum (supremum) depend on the data type used to store the image. These values are important to compute many morphological operators (for instance, negate of an image). The output is a vector, where the first element is the infimum and the second, the supremum.

Examples

>>> print mmlimits(mmbinary([0, 1, 0]))
[0 1]
>>> print mmlimits(uint8([0, 1, 2]))
[  0 255]

Source Code

def mmlimits(f):
    from Numeric import array
    code = f.typecode()
    if   code == '1': y=array([0,1])
    elif code == 'b': y=array([0,255])
    elif code == 'w': y=array([0,65535])
    elif code == 'i': y=array([-2147483647,2147483647])
    else:
        assert 0,'Does not accept this typecode:'+code
    return y
    

See also

mmneg Negate an image.
[mmconcat] [Up] [mmmaxleveltype] Python