Function iasupcanon

namespace:morph
page:iasupcanon

Synopse

Union of sup-generating or hit-miss operators.

  • y = iasupcanon(f, Iab, theta=45, DIRECTION="CLOCKWISE")
    • y: Image
    • f: Image
    • Iab: Interval
    • theta: Double Degrees of rotation: 45, 90, or 180.
    • DIRECTION: String Direction of rotation: 'CLOCKWISE' or ' ANTI-CLOCKWISE'
01. from numpy import *
02. from string import upper
03. 
04. def iasupcanon(f, Iab, theta=45, DIRECTION="CLOCKWISE"):
05.     from iaintersec import iaintersec
06.     from iainterot import iainterot
07.     from iaunion import iaunion
08.     from iasupgen import iasupgen
09. 
10.     DIRECTION = upper(DIRECTION)
11.     y = iaintersec(f,0)
12.     for t in range(0,360,theta):
13.         Irot = iainterot( Iab, t, DIRECTION )
14.         y = iaunion( y, iasupgen(f, Irot))
15. 
16.     return y

Description

iasupcanon creates the image y by computing the union of transformations of the image f by sup-generating operators. These hit-miss operators are characterized by rotations (in the clockwise or anti-clockwise direction) of theta degrees of the interval Iab.

Examples

Example 1

01. from ia870 import iasupcanon
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=iasupcanon(f,i)
14. print g
. . . 
0 0 0 
0 0 0 

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

Example 2

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

Equation

Algorithm

function y=iasupcanon_equ( f, Iab, theta, DIRECTION )
  y = uint8(zeros(size(f)));
  y = iaunion(y,iasupgen(f, Iab));
  alpha = theta;
  while alpha < 360
    Irot = iainterot( Iab, alpha, DIRECTION );
    y = iaunion(y,iasupgen(f, Irot));
    alpha = alpha + theta;
  end;