Toolbox ia870 | List of Figures | Fig. 7.11 | Fig. 7.13

Figure 7.12 - Segmentation of overlapped blood cells

Description

The foregoing technique is applied to an image of blood cells in Fig. 7.12: (a) input image, (b) shaded view of the distance function overlaid by the regional maxima being used as markers, (c) the watershed lines overlaid on part (b), and (d) the input image segmented by the watershed lines.

Demo Script

 1 import ia870 as MT
 2 import ia636 as ia
 3 
 4 a = adreadgray('bloodcells.tif')
 5 b  = MT.iaareaopen(a, 200)
 6 c  = MT.iacmp( uint8(0), '<=', b, '<=', uint8(140));
 7 d  = MT.iaopen(c,MT.iasedisk(2,'2D','EUCLIDEAN'))
 8 
 9 e1 = MT.iadist(c, MT.iasebox(),'EUCLIDEAN')
10 e2 = 255 - MT.iagsurf(e1)
11 e3 = MT.iaregmax(e1)
12 
13 e  = MT.iadil(e3)
14 f  = MT.ianeg(e1)
15 g  = MT.iacwatershed( f, e, MT.iasebox())
16 h  = MT.iaintersec(c,MT.ianeg(g))
17 i  = MT.iaedgeoff(h)
18 j  = MT.iagradm(i)
19 
20 fig_a = c
21 fig_b = MT.iaunion(MT.iagray(e),e2)
22 fig_c = MT.iaunion(e2,MT.iagray(g),MT.iagray(e))
23 fig_d = h
24 
25 adshow(MT.iapad(fig_a), '(a)')
26 adshow(fig_b, '(b)')
27 adshow(ia.ianormalize(MT.iapad(MT.ianeg(fig_c))), '(c)')
28 adshow(MT.iapad(fig_d), '(d)')

(a)

(b)

(c)

(d)