# mmthreshad
Threshold (adaptive)

## Synopsis

y = mmthreshad( f, f1, f2 = None )

Implemented in Python.

### Input

f | Image Gray-scale (uint8 or uint16) image.
f1 | Image Gray-scale (uint8 or uint16) image. lower value
f2 | Image Gray-scale (uint8 or uint16) image. upper value Default: `None`

### Output

y | Image Binary image.

## Description

mmthreshad creates the image `y` as the threshold of the image `f` by the images `f1` and `f2`. A pixel in `y` has the value 1 when the value of the corresponding pixel in `f` is between the values of the corresponding pixels in `f1` and `f2`.

## Examples

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

    >>> mmshow(a)

    >>> b = mmthreshad(a,uint8(10), uint8(50))

    >>> mmshow(b)

    >>> c = mmthreshad(a,238)

    Warning: Converting input image from int32 to uint8.

    >>> mmshow(c)

a | b |

c |

## Equation

## Source Code

    def mmthreshad(f, f1, f2=None):
        if f2 is None:
          y = mmbinary(f1 <= f)
        else:
          y = mmbinary((f1 <= f) & (f <= f2))
        return y

## See also

mmfreedom | Control automatic data type conversion.
mmgray | Convert a binary image into a gray-scale image.
mmbinary | Convert a gray-scale image into a binary image
mmcmp | Compare two images pixelwisely.

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