# Figure 3.13 - Reconstruction using geodesic dilations

## Description

An illustration of reconstruction using geodesic dilation is shown in Fig. 3.13: (a) three-component image with one component marked by a pixel; (b) one conditional dilation; (c) two conditional dilations; (d) three conditional dilations; (e) four conditional dilations; (f) five conditional dilations, with stability being reached. A drawback of the conditional-dilation approach to morphological reconstruction is that it can be time consuming; indeed, it is possible for the number of conditional dilations to equal the number of pixels in the input image. There are, however, very efficient reconstruction algorithms that work recursively and require only a few image scannings.

## Demo Script

``` 1 import numpy as np
2 import ia870 as MT
3
4 A=np.array([
5     [0,0,0,1,0,0,0,0,0,0],
6     [0,1,1,1,1,1,1,0,0,0],
7     [0,1,1,1,1,1,1,1,0,1],
8     [0,1,1,1,1,1,1,1,0,1],
9     [0,0,0,0,1,1,1,1,0,1],
10     [1,1,1,0,1,1,1,1,0,0],
11     [1,1,1,0,0,0,0,1,1,0]],dtype='bool')
12
13 M = MT.iaintersec(A,0)
14 M[2,3]=1
15 M1 = MT.iacdil(M,A,MT.iasebox(),1)
16 M2 = MT.iacdil(M,A,MT.iasebox(),2)
17 M3 = MT.iacdil(M,A,MT.iasebox(),3)
18 M4 = MT.iacdil(M,A,MT.iasebox(),4)
19 M5 = MT.iacdil(M,A,MT.iasebox(),5)
20