Toolbox ia870 | List of Figures | Fig. 3.21 | Fig. 3.23

Figure 3.22 - Logical opening, identifying overlapping chromosomes

Description

Figure 3.22 Logical opening: (a) input image, (b) conjunctive opening of four linear elements: horizontal, vertical, 45 deg and -45 deg, (c) opening by horizontal and its reconstruction (light gray), (d) vertical element, (e) 45 -deg element, (f)  45 -deg element.

Demo Script

 1 import ia870 as MT
 2 
 3 f = adreadgray('MVBook/chromosomes.png')
 4 L=30
 5 r0   = MT.iaopen(f,MT.iaseline(L,0))
 6 r45  = MT.iaopen(f,MT.iaseline(L,45))
 7 r90  = MT.iaopen(f,MT.iaseline(L,90))
 8 
 9 rm45 = MT.iaopen(f,MT.iaseline(L,-45))
10 r0_rec   = MT.iainfrec(r0,f)
11 r45_rec  = MT.iainfrec(r45,f)
12 r90_rec  = MT.iainfrec(r90,f)
13 
14 rm45_rec = MT.iainfrec(rm45,f)
15 g =  MT.iaintersec(r0_rec,r45_rec,r90_rec,rm45_rec)
16 
17 fig_a = f
18 fig_b = g
19 fig_c = MT.iaunion(MT.iagray(r0),MT.iagray(r0_rec,'uint8',140))
20 fig_d = MT.iaunion(MT.iagray(r90),MT.iagray(r90_rec,'uint8',140))
21 fig_e = MT.iaunion(MT.iagray(r45),MT.iagray(r45_rec,'uint8',140))
22 fig_f = MT.iaunion(MT.iagray(rm45),MT.iagray(rm45_rec,'uint8',140))
23 
24 adshow(MT.iapad(MT.ianeg(fig_a)), '(a)')
25 adshow(MT.iapad(MT.ianeg(fig_b)), '(b)')
26 adshow(MT.iapad(MT.ianeg(fig_c)), '(c)')
27 adshow(MT.iapad(MT.ianeg(fig_d)), '(d)')
28 adshow(MT.iapad(MT.ianeg(fig_e)), '(e)')
29 adshow(MT.iapad(MT.ianeg(fig_f)), '(f)')

(a)

(b)

(c)

(d)

(e)

(f)