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

Figure 3.24 - Connected operators

Description

This figure illustrates the partitions of a binary image and the application of a connected operator.

Demo Script

 1 import numpy as np
 2 import ia870 as MT
 3 
 4 f = adreadgray('pcbholes.tif')
 5 f=rot90(rot90(f))
 6 f=f[:,:-10]
 7 
 8 fr1 = MT.ialabel(f)
 9 fr2 = MT.ialabelflat(f)
10 
11 a = MT.iaopen(f,MT.iasedisk(10))
12 b = MT.iaopenrec(f,MT.iasedisk(10))
13 
14 fr3 = MT.ialabelflat(b)
15 adshow(MT.iapad(MT.ianeg(f)), '(a)')
16 
17 adshow(MT.ianeg(MT.iaglblshow(fr1,'BORDER')), '(b)')
18 adshow(MT.ianeg(MT.iaglblshow(fr2,'BORDER')), '(c)')
19 
20 fig_d = MT.iaunion(MT.iagradm(f,MT.iasecross(0)),a)
21 fig_e = MT.iaunion(MT.iagradm(f,MT.iasecross(0)),b)
22 
23 adshow(MT.iapad(MT.ianeg(fig_d)), '(d)')
24 adshow(MT.iapad(MT.ianeg(fig_e)), '(e)')
25 adshow(MT.ianeg(MT.iaglblshow(fr3,'BORDER')), '(f)')

(a)

(b)

(c)

(d)

(e)

(f)