Skip to main content
. 2024 Feb 28;10:e1900. doi: 10.7717/peerj-cs.1900

Table 2. The pseudocode of the proposed algorithm.

Algorithm Multi-feature fusion based on principal component analysis and Bayesian theory
1:Intput: Image I of PCB bare board defects to be detected
2:Construct 4-layer Gaussian pyramid image I1,I2,,I3,I4 of defect image I of PCB bare
board to be detected
3:Calculate the multi-scale gray level co-occurrence matrix feature vector
GLCM=GLCM1,GLCM2,GLCM3,GLCM4 of I via Eqs. (1)(8)
4:Calculate the multi-scale directional projection feature vectors
pro=XRMS,Xr,Xsk,Xmean,Xpeak,Ku,SF,IF,L,ICF for I via Eqs. (9)(20)
5:Calculate the multi-scale gradient direction information entropy feature vector
Ent = [H1H2H3H4] of I for I via Eqs. (21)(25)
6:Calculating the deep semantic feature vector D = [d1d2d3, …, dn], n = 512 of I based
on the improved VGG-16 neural network
7:Extract features from image I to obtain M feature vectors X1,X2,,,XM
8:Reduce the dimension of X1,X2,,,XM via Eqs. (26)(30), obtain N feature vectors
X1,X2,,,Xn
9:Calculate the weight W1,W2,,,Wn of each feature vector of X1,X2,,,XN via Eqs. (31)(38)
10:Calculate the feature vector V after parallel weighted fusion via Eq. (39)
11:Output: the feature vector V=C1,C2,,Cn after parallel weighted fusion