# Function iacenter

namespace: morph iacenter

# Synopse

Center filter.

• y = iacenter(f, b=ia_secross(NULL))
• y: Image
• f: Image
• b: Structuring Element
```01. from numpy import *
02.
03. def iacenter(f, b=None):
04.     from iaasf import iaasf
05.     from iaunion import iaunion
06.     from iaintersec import iaintersec
07.     from iaisequal import iaisequal
08.     from iasecross import iasecross
09.     if b is None:
10.         b = iasecross(None)
11.
12.     y = f
13.     diff = 0
14.     while not diff:
15.         aux = y
16.         beta1 = iaasf(y,'COC',b,1)
17.         beta2 = iaasf(y,'OCO',b,1)
18.         y = iaunion( iaintersec(y,beta1),beta2)
19.         diff = iaisequal(aux,y)
20.
21.     return y```

# Description

iacenter creates the image y by computing recursively the morphological center, relative to the structuring element b, of the image f .

# Examples

## Example 1

```1. from ia870 import iacenter
2. from ia870 import iasedisk
3.
4.
5. f=mmreadgray('gear.tif')
6. g=iacenter(f,iasedisk(2))
7. mmshow(f)
8. mmshow(g)```

# Algorithm

```function y=iacenter_equ( f, b )
y = f;
diff = 0;
while(diff~=1)
aux = y;
beta1 = iaasf(y,'COC',b,1);
beta2 = iaasf(y,'OCO',b,1);
y = iaunion(iaintersec(y,beta1),beta2);
diff = iaisequal(aux,y);
end;
```