# mmgradm
Morphological gradient.

## Synopsis

y = mmgradm( f, Bdil = None, Bero = None )

Implemented in Python.

### Input

f | Image Gray-scale (uint8 or uint16) or binary image.
Bdil | Structuring Element for the dilation. Default: `None` (3x3 elementary cross)
Bero | Structuring Element for the erosion. Default: `None` (3x3 elementary cross)

### Output

y | Image Gray-scale (uint8 or uint16) or binary image. (same type of `f`).

## Description

mmgradm creates the image `y` by the subtraction of the erosion of the image `f` by `Bero` of the dilation of `f` by `Bdil`.

## Examples

Binary image:
Binary image, internal and external gradient:
Gray-scale

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

    >>> b = mmgradm(a)

    >>> mmshow(a)

    >>> mmshow(b)

a | b |

Binary image, internal and external gradient:

    >>> c=mmgradm(a,mmsecross(0),mmsecross())

    >>> d=mmgradm(a,mmsecross(),mmsecross(0))

    >>> mmshow(a,c)

    >>> mmshow(a,d)

a,c | a,d |

Gray-scale

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

    >>> b = mmgradm(a)

    >>> mmshow(a)

    >>> mmshow(b)

a | b |

## Equation

## Source Code

    def mmgradm(f, Bdil=None, Bero=None):
        if Bdil is None: Bdil = mmsecross()
        if Bero is None: Bero = mmsecross()
        y = mmsubm(mmdil(f,Bdil),mmero(f,Bero))
        return y

## See also

mmfreedom | Control automatic data type conversion.
mmdil | Dilate an image by a structuring element.
mmero | Erode an image by a structuring element.

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