Function iacthick

Synopse

Image transformation by conditional thickening.

  • y = iacthick(f, g, Iab=ia_homothick(), n=-1, theta=45, DIRECTION="CLOCKWISE")
    • y: Image
    • f: Image
    • g: Image
    • Iab: Interval
    • n: Double Number of iterations.
    • 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 iacthick(f, g, Iab=None, n=-1, theta=45, DIRECTION="CLOCKWISE"):
05.     from iaisbinary import iaisbinary
06.     from iasupgen import iasupgen
07.     from iainterot import iainterot
08.     from iaintersec import iaintersec
09.     from iaunion import iaunion
10.     from iaisequal import iaisequal
11.     from iahomothick import iahomothick
12.     if Iab is None:
13.         Iab = iahomothick()
14. 
15.     DIRECTION = upper(DIRECTION)
16.     assert iaisbinary(f),'f must be binary image'
17.     if n == -1: n = product(f.shape)
18.     y = f
19.     old = y
20.     for i in range(n):
21.         for t in range(0,360,theta):
22.             sup = iasupgen( y, iainterot(Iab, t, DIRECTION))
23.             y = iaintersec( iaunion( y, sup),g)
24.         if iaisequal(old,y): break
25.         old = y
26. 
27.     return y

Description

iacthick creates the binary image y by performing a thickening of the binary image f conditioned to the binary image g. The number of iterations of the conditional thickening is n and in each iteration the thickening is characterized by rotations of theta of the interval Iab.

Examples

Example 1

01. from ia870 import iacthick
02. from ia870 import iase2hmt
03. from ia870 import iabinary
04. from ia870 import iaintershow
05. from ia870 import iathick
06. 
07. 
08. f=mmreadgray('blob2.tif')
09. adshow(f)
10. t=iase2hmt( iabinary([[0,0,0],[0,0,1],[1,1,1]]),
11.                           iabinary([[0,0,0],[0,1,0],[0,0,0]]))
12. print iaintershow(t)
13. f1=iathick(f,t,40); # The thickening makes the image border grow
14. adshow(f1)
. . . 
. 0 0 
0 0 0

Example 2

1. from ia870 import ianeg
2. from ia870 import iaframe
3. from ia870 import iagshow
4. 
5. f2=iacthick(f,ianeg( iaframe(f)),t,40) # conditioning to inner pixels
6. fn=iacthick(f,ianeg( iaframe(f)),t) #pseudo convex hull
7. adshow(f2)
8. adshow(iagshow(fn,f))

Equation