Function iagradm

namespace:morph
page:iagradm

Synopse

Morphological gradient.

  • y = iagradm(f, Bdil=ia_secross(NULL), Bero=ia_secross(NULL))
    • y: Image
    • f: Image
    • Bdil: Structuring Element for the dilation.
    • Bero: Structuring Element for the erosion.
01. from numpy import *
02. 
03. def iagradm(f, Bdil=None, Bero=None):
04.     from iasubm import iasubm
05.     from iadil import iadil
06.     from iaero import iaero
07.     from iasecross import iasecross
08.     if Bdil is None: Bdil = iasecross()
09.     if Bero is None: Bero = iasecross()
10. 
11.     y = iasubm( iadil(f,Bdil),iaero(f,Bero))
12.     return y

Description

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

Examples

Example 1

1. from ia870 import iagradm
2. 
3. 
4. a = mmreadgray('small_bw.tif')
5. b = iagradm(a)
6. mmshow(a)
7. mmshow(b)

Example 2

1. from ia870 import iasecross
2. 
3. 
4. c=iagradm(a,iasecross(0),iasecross())
5. d=iagradm(a,iasecross(),iasecross(0))
6. mmshow(a,c)
7. mmshow(a,d)

Example 3

1. a = mmreadgray('bloodcells.tif')
2. b = iagradm(a)
3. mmshow(a)
4. mmshow(b)

Equation

Algorithm

function y=iagradm_equ( f, bdil, bero)
  y = iasubm(iadil(f,bdil),iaero(f,bero));