# mmbinary
Convert a gray-scale image into a binary image

## Synopsis

y = mmbinary( f, k1 = 1 )

Implemented in Python.

### Input

f | Image Unsigned gray-scale (uint8 or uint16), signed (int32) or binary image.
k1 | Double Threshold value. Default: `1`

### Output

y | Image Binary image.

## Description

mmbinary converts a gray-scale image `f` into a binary image `y` by a threshold rule. A pixel in `y` has the value 1 if and only if the corresponding pixel in `f` has a value greater or equal `k1`.

## Examples

    >>> a = array([0, 1, 2, 3, 4])

    >>> b=mmbinary(a)

    >>> print b

    [0 1 1 1 1]

    >>> a=mmreadgray('mm3.tif')

    >>> b=mmbinary(a,82)

    >>> mmshow(a)

    >>> mmshow(b)

a | b |

## Equation

## Source Code

    def mmbinary(f, k1=1):
        from Numeric import array
        if type(f) is not array: f = array(f)
        y = array(f>=k1).astype('1')
        return y

## See also

mmthreshad | Threshold (adaptive)
mmisbinary | Check for binary image
mmgray | Convert a binary image into a gray-scale image.

[Up] [`mmfreedom`] |
Copyright (c) 2003, Roberto A. Lotufo, UNICAMP-University of Campinas; Rubens C. Machado, CenPRA-Renato Archer Research Center.