Toolbox ia870 | List of Figures | Fig. 7.2 | Fig. 7.6

Figure 7.4 - Watershed oversegmentation

Description

For image segmentation, the watershed is usually applied on a gradient image. As real digitized images present many regional minima in their gradients, this typically results in a large number of catchment basins. This characteristic, called “watershed oversegmentation,” is illustrated in Fig. 7.4: (a) the morphological gradient, (b) regional minima, and (c) catchment basins of the watershed transform originating from all regional minima.

Demo Script

 1 import ia870 as MT
 2 import numpy as np
 3 
 4 f = np.transpose(adreadgray('beef.tif'))
 5 
 6 g1 = MT.iagradm(MT.iaclose(f))
 7 adshow(MT.iapad(MT.ianeg(g1)), '(a)')
 8 
 9 g2 = MT.iaregmin(g1)
10 adshow(MT.ianeg(g2), '(b)')
11 
12 y = MT.iacwatershed(g1,g2)
13 adshow(MT.iapad(MT.ianeg(y)),'(c)')

(a)

(b)

(c)