Toolbox ia870 | List of Figures | Fig. 4.9 | Fig. 4.12

Figure 4.10 and 4.11 - Detection of open connection in printed circuit

Description

To illustrate the manner in which the methodologies of the present chapter can be employed, we consider a problem involving inspection of printed circuit boards, the specific task being to find open connections on the top layer of the PCB. We outline the steps in the algorithm. In Fig. 4.10(a), we see a defective connection in the upper side of the image. An opening of this image by a disk of radius 6, shown in Fig. 4.10(b), detects the pads of the PCB. Two iterations of geodesic dilation extract the pad regions, as shown in Fig. 4.10(c). This image will be used to discard endpoints at the pads. If instead of opening and dilating the binary image we thin to generate a connected one-pixel-thick skeletal sub-image, then the image of Fig. 4.10(d) is obtained.

This image is pruned for two cycles to remove spurious endpoints, shown in Fig. 4.11(a). Fig. 4.11(b) shows the endpoints of the pruned skeleton. A subtraction of the pad image from the endpoint image [Fig. 4.11(c)] leaves endpoint pixels marking breaks in the circuit and in the boundary of the image. A dilation of these endpoints, shown in Fig. 4.11(d), allows the elimination of the endpoints detected near the image frame using the edgeoff function as illustrated in Figure 3.15 The final endpoint detection is shown in Fig. 4.11(e).

Demo Script

 1 import ia870 as MT
 2 import ia636 as ia
 3 
 4 S = adreadgray('pcb1bin.tif') > 0
 5 S[49:70,149:170]=0                       # fault simulation
 6 S1 = MT.iaclohole(S);                    # input image
 7 S2 = MT.iaopen(S1,MT.iasedisk(6));       # open for pads
 8 S3 = MT.iacdil(S2,S1,MT.iasebox(),3);    # pads
 9 S4 = MT.iathin(S1);                      # thinning original
10 S5 = MT.iathin(S4,MT.iaendpoints(),2);   # prunning
11 S6 = MT.iasupcanon(S5,MT.iaendpoints()); # endpoints
12 S7 = MT.iasubm(S6,S3);                   # endpoints not at the pads
13 S8 = MT.iadil(S7,MT.iasedisk(6));        # mark endpoints
14 S9 = MT.iaedgeoff(S8);                   # remove those near the image frame
15 
16 a = mmgray(S1); #input image
17 b = MT.iaunion(MT.iagray(S1,'uint8',130),MT.iagray(S2));
18 c = MT.iaunion(MT.iagray(S1,'uint8',130),MT.iagray(S3));  #pads
19 d = MT.iaunion(MT.iagray(S1,'uint8',130),MT.iagray(S4));  #thin
20 e = MT.iaunion(MT.iagray(S4,'uint8',130),MT.iagray(S5));  #prunning
21 f = MT.iaunion(MT.iagray(S5,'uint8',150),MT.iadil(MT.iagray(S6)));  #thin, endpoints
22 g = MT.iaunion(MT.iagray(S3,'uint8',100),MT.iadil(MT.iagray(S6,'uint8',180)),MT.iadil(MT.iagray(S7)));
23 h = MT.iaunion(MT.iagray(S1,'uint8',130),MT.iagray(S8));
24 i = MT.iaunion(MT.iagray(S1,'uint8',130),MT.iagray(S9));
25 
26 adshow(MT.iapad(MT.ianeg(a)), 'Fig. 4.10 (a)')
27 adshow(MT.iapad(MT.ianeg(b)), 'Fig. 4.10 (b)')
28 adshow(MT.iapad(MT.ianeg(c)), 'Fig. 4.10 (c)')
29 adshow(MT.iapad(MT.ianeg(d)), 'Fig. 4.10 (d)')
30 adshow(MT.iapad(MT.ianeg(e)), 'Fig. 4.11 (a)')
31 adshow(MT.iapad(MT.ianeg(f)), 'Fig. 4.11 (b)')
32 adshow(MT.iapad(MT.ianeg(g)), 'Fig. 4.11 (c)')
33 adshow(MT.iapad(MT.ianeg(h)), 'Fig. 4.11 (d)')
34 adshow(MT.iapad(MT.ianeg(i)), 'Fig. 4.11 (e)')

Fig. 4.10 (a)

Fig. 4.10 (b)

Fig. 4.10 (c)

Fig. 4.10 (d)

Fig. 4.11 (a)

Fig. 4.11 (b)

Fig. 4.11 (c)

Fig. 4.11 (d)

Fig. 4.11 (e)