Toolbox ia870 | List of Figures | Fig. 7.8 | Fig. 7.10

Figure 7.9 - Voronoi diagram from watershed of the distance transform


Figure 7.9 illustrates the computation of the Voronoi diagram of isolated points: (a) binary input image with points as grains, (b) distance function of the background to the points, and (c) watershed lines as the Voronoi diagram superimposed on the input image. This illustration gives a geometrically intuitive notion of the watershed transform. We can also observe the similarity of this image with many forms in biology. Many types of cells are grouped like Voronoi diagrams

Demo Script

 1 import numpy as np
 2 import ia870 as MT
 3 import ia636 as ia
 5 a = np.random.rand(256, 256) > 0.999
 7 d = MT.iadist(MT.ianeg(a),MT.iasebox(),'EUCLIDEAN')
 8 ws = MT.iacwatershed(d,MT.iaregmin(d))
10 adshow(ia.ianormalize(MT.iapad(MT.ianeg(MT.iadil(a)))), '(a)')
11 adshow(ia.ianormalize(MT.iapad(MT.ianeg(MT.iagsurf(d)))),'(b)')
12 adshow(ia.ianormalize(MT.iapad(MT.ianeg(MT.iaunion(ws,MT.iadil(a))))),'(c)')