Function iaregmax

namespace:morph
page:iaregmax

Synopse

Regional Maximum.

  • y = iaregmax(f, Bc=iasecross())
    • y: Image
    • f: Image
    • Bc: Structuring Element (connectivity).
01. from numpy import *
02. from iasecross import iasecross
03. 
04. def iaregmax(f, Bc=iasecross()):
05.     from iasubm import iasubm
06.     from iahmax import iahmax
07.     from iabinary import iabinary
08.     from iaregmin import iaregmin
09.     from ianeg import ianeg
10. 
11.     y = iasubm(f, iahmax(f,1,Bc))
12.     return iabinary(y)
13.     #return iaregmin( ianeg(f),Bc)

Description

iaregmax creates a binary image y by computing the regional maxima of f, according to the connectivity defined by the structuring element Bc. A regional maximum is a flat zone not surrounded by flat zones of higher gray values.

Examples

Example 1

01. from ia870 import iaregmax
02. from ia870 import iasecross
03. 
04. 
05. a = array([
06.     [10, 255, 255,  10,  10,  10,  10],
07.     [10,   9,   6,  18,   6,  15,  10],
08.     [10,   9,   6,  18,   6,  15,  10],
09.     [10,   9,   9,  15,   0,   9,  10],
10.     [10,   9,   9,  15,  12,  10,  10],
11.     [10,  10,  10,  10,  10,  10,  10]],uint8)
12. 
13. print iaregmax(a) * 1
[[0 1 1 0 0 0 0]
 [0 0 0 1 0 1 0]
 [0 0 0 1 0 1 0]
 [0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0]]

Example 2

01. from ia870 import *
02. 
03. f=adreadgray('astablet.tif')
04. y1=iaregmax(f)
05. f2=iaopen(f,iasedisk(20,'2D','octagon'))
06. y2=iaregmax(f2)
07. adshow(f)
08. adshow(y1)
09. adshow(f2)
10. adshow(y2)

See Also

Equation