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

Figure 7.11 - Segmentation of overlapped convex cells


One of the earliest purposes of the watershed transform was to address the problem of binary-image segmentation from the perspective of there being objects within the image that are touching or overlapping. For instance, in Fig. 7.11(a), there appears to be two objects overlapping to form a single connected component. Our goal is to segment the single component in a manner consistent with the integrity of each of the two objects. A key to this problem, and with many segmentation problems, is to find markers for each of the two objects.

The binary-image segmentation works in the following way and is illustrated in Fig. 7.11. The distance transform [part (b)] is computed and one marker is required for each cell. In this case of rounded cells, these markers can be extracted from the regional maxima of the distance function.

The markers and the watershed lines are displayed in part (c) of Fig. 7.11 and the final segmentation is shown in part (d)

Demo Script

 1 import ia870 as MT
 2 import ia636 as ia
 4 f = adreadgray('MVBook/touchcell.png')
 5 d = MT.iadist(f,MT.iasecross(),'EUCLIDEAN')
 6 marker = MT.iaregmax(MT.iaopen(d))
 7 ws = MT.iacwatershed(MT.ianeg(d),marker)
 8 g = MT.iaintersec(MT.ianeg(ws),f)
10 adshow(MT.iapad(MT.ianeg(f)),'(a) input image');
11 adshow(ia.ianormalize(MT.ianeg(MT.iagsurf(d))),'(b) distance transform');
12 adshow(MT.iagshow(marker,ws),'(c) markers and watershed line');
13 adshow(MT.iapad(MT.ianeg(g)),'(d) watershed line used to separate the cells');

(a) input image

(b) distance transform

(c) markers and watershed line

(d) watershed line used to separate the cells