# Synopse

Dilate an image by a structuring element.

• y: Image
• f: Image
• b: Structuring Element
``` 1 from numpy import *
2
4     from iamat2set import iamat2set
5     from ialimits import ialimits
6     from iaisbinary import iaisbinary
7     from iaintersec import iaintersec
8     from iagray import iagray
10     from iasecross import iasecross
11
12     if b is None: b = iasecross()
13
14     if len(f.shape) == 1: f = f[newaxis,:]
15     h,w = f.shape
16     x,v = iamat2set(b)
17     if len(x)==0:
18         y = (ones((h,w)) * ialimits(f)[0]).astype(f.dtype)
19     else:
20         if iaisbinary(v):
21             v = iaintersec( iagray(v,'int32'),0)
22         mh,mw = max(abs(x)[:,0]),max(abs(x)[:,1])
23         y = (ones((h+2*mh,w+2*mw)) * ialimits(f)[0]).astype(f.dtype)
24         for i in range(x.shape[0]):
25             if v[i] > -2147483647:
26                 y[mh+x[i,0]:mh+x[i,0]+h, mw+x[i,1]:mw+x[i,1]+w] = maximum(
28         y = y[mh:mh+h, mw:mw+w]
29
30     return y
```

# Description

iadil performs the dilation of image f by the structuring element b. Dilation is a neighbourhood operator that compares locally b with f, according to an intersection rule. Since Dilation is a fundamental operator to the construction of all other morphological operators, it is also called an elementary operator of Mathematical Morphology. When f is a gray-scale image, b may be a flat or non-flat structuring element.

# Examples

## Example 1

``` 1 import numpy as np
3 from ia870 import iabinary
4
5 f=iabinary([
6    [0, 0, 0, 0, 0, 0, 1],
7    [0, 1, 0, 0, 0, 0, 0],
8    [0, 0, 0, 0, 1, 0, 0]])
9 b=iabinary([1, 1, 0])
11 f=uint8([
12    [ 0,   1,  2, 50,  4,  5],
13    [ 2,   3,  4,  0,  0,  0],
14    [12, 255, 14, 15, 16, 17]])
```
```[[0 0 0 0 0 1 1]
[1 1 0 0 0 0 0]
[0 0 0 1 1 0 0]]
[[  1   2  50  50   5   5]
[  3   4   4   0   0   0]
[255 255  15  16  17  17]]
```

## Example 2

``` 1 from ia870 import iaimg2se
3 from ia870 import iagshow
4 import ia636 as ia
5
8 b=iaimg2se(bimg)
```

## Example 3

```1 from ia870 import iasedisk
2
4 b=iasedisk(5)
```

```1 from ia870 import iasecross
2
3 f = iabinary(np.ones((5,4)))
4 f[2:4,2:4] = 0
5 print 'f=\n',
```
```f=
[[ True  True  True  True]
[ True  True  True  True]
[ True  True  True  True]
[ True  True  True  True]
[ True  True  True  True]]
------------------------------------------------------------
*** Exception while evaluating code:
File "<string>", line 7, in <module>