Function iasupgen

namespace:morph
page:iasupgen

Synopse

Sup-generating (hit-miss).

  • y = iasupgen(f, INTER)
    • y: Image
    • f: Image
    • INTER: Interval
01. from numpy import *
02. 
03. def iasupgen(f, INTER):
04.     from iaintersec import iaintersec
05.     from iaero import iaero
06.     from ianeg import ianeg
07. 
08. 
09.     A,Bc = INTER
10.     y = iaintersec( iaero( f, A),
11.                    iaero( ianeg(f), Bc))
12. 
13.     return y

Description

iasupgen creates the binary image y by computing the transformation of the image f by the sup-generating operator characterized by the interval Iab. The sup-generating operator is just a relaxed template matching, where the criterion to keep a shape is that it be inside the interval Iab. Note that we have the classical template matching when a=b. Note yet that the sup-generating operator is equivalent to the classical hit-miss operator.

Examples

Example 1

01. from ia870 import iasupgen
02. from ia870 import iabinary
03. from ia870 import iaendpoints
04. from ia870 import iaintershow
05. 
06. 
07. f=iabinary([
08.    [0,0,1,0,0,1,1],
09.    [0,1,0,0,1,0,0],
10.    [0,0,0,1,1,0,0]])
11. i=iaendpoints()
12. print iaintershow(i)
13. g=iasupgen(f,i)
14. print g
. . . 
0 0 0 
0 0 0 

[[False False False False False False False]
 [False  True False False False False False]
 [False False False False False False False]]

Example 2

1. from ia870 import iadil
2. 
3. 
4. a=mmreadgray('gear.tif')
5. b=iasupgen(a,iaendpoints())
6. mmshow(a)
7. mmshow( iadil(b))

Equation

Algorithm

function y=iasupgen_equ( f, A, BC )
  y = iaintersec(iaero(f,A),iaero(ianeg(f),BC));