IJCSES International Journal of Computer Sciences and Engineering Systems, Vol. 5, No. 3, July 2011 CSES International 2011 ISSN 0973-4406 An Algorithm for Classification of Five Types of Defects on Bare Printed Circuit Board Ismail IBRAHIM, Zuwairie IBRAHIM, Kamal KHALIL, Musa MOHD MOKJI and Syed Abdul Rahman SYED ABU BAKAR Faculty of Electrical Engineering, Universiti Teknologi Malaysia, 81310 UTM Johor Bahru, Johor, Malaysia E-mail: zuwairie@fke.utm.my Abstract: This paper presents a technique for classification of five types of defect on bare printed circuit board (PCB). Due to decisions made by human inspectors often involve subjective judgment, in addition to being intensive and therefore costly, an automated approach for printed circuit board inspection is preferred to eliminate subjective aspects and provides fast, quantitative, and dimensional assessments. In this research, image understanding is the important part in the inspection of printed circuit boards in order to detect defects and then classify them to several groups. Defect classification is an essential part in this research in order to identify the source of defects. Due to the importance of defect classification, a new algorithm for PCB defect classification are proposed which consist of well-known conventional operations such as image difference, image subtraction, image addition, and image comparison, for the classification of five different defects, namely, missing hole, pin hole, underetch, short-circuit, and open-circuit, successfully. Key words: Printed Circuit Board, Defect Classification. 1. INTRODUCTION The Bare PCB means the printed circuit board before the insertion or placement of components and the soldering process [1]. It is used along with other components to produce electrics goods. In order to reduce cost spending in manufacturing caused by the defected bare PCB, it is by all mean required to inspect the bare PCB at the foremost step. Many important applications of vision are used in manufacturing processes. The processes start from inspection work, measurement, and then some assembly operations. One of these applications is the automatic visual inspection of printed circuit boards (PCB). Many existing PCB inspection systems just concentrated on defects detection, as reported in [2]. Defects detection did not provide satisfactory information for repairing and quality control work, since the type of detected defects cannot be clearly identified. Based on this incapability of defects detection, defect classification operation is needed in PCB inspection. Therefore, an accurate defect classification procedure is essential especially for Manuscript received June 2, 2009 Manuscript revised November, 2009 an on-line inspection system during PCB production process [3]. 2. LITERATURE REVIEW Moganti et al. [2] proposed three categories of inspection algorithm: referential approaches, nonreferential approaches, and hybrid approaches. The reference approaches is performed, by doing a comparison between the template PCB image and tested PCB image. There are two major techniques; image comparison techniques and model based inspection. Image comparison, which is the simplest approach, consists of comparing both images pixelby-pixel using simple logic operators such as XOR. The main difficulty found in these techniques is determining a precise alignment of the reference image and the test image, which makes its utilization difficult. More sophisticated proposals under the same idea, involve feature and template matching [2], but suffer from the same problem and normally require a large number of templates. This technique can be subdivided to image subtraction, template matching, and phase only method. Model-based methods are techniques, which match the pattern under inspection with a set of predefined models. They are also called Graph-
202 IJCSES International Journal of Computer Sciences and Engineering Systems, Vol. 5, No. 3, July 2011 Matching Methods [2] and are based on the structural, topological, and geometrical properties of the image. The major difficulty of those methods is related to the matching complexity. Although Sun et al. [4] proposed a technique called Pattern Attributed Hypergraph to make the method more practical, it still remains a complex and time consuming method. This technique can be subdivided to tree, syntactic, and graph matching method. Non-referential approaches or design-rule verification methods are based on the verification of the general design rules that is essentially the verification of the widths of conductors and insulators. As a kind of automatic inspection algorithm for bare PCB, the design rule checking (DRC) has been proposed and well known to the automated optical inspection system manufacturers [1]. Design rule checking method checks if all patterns and spaces of PCB surface meet or violate common knowledge of the design rule. Since a simple algorithm is applied directly to achieve image, the implementation of this algorithm is comparatively easy. This means it does not require severe alignment and adjustment of a mechanical part to get the non distorted image. However, this method is very time consuming process and a great computing power is needed to meet the requirement of inspection time and much time is taken to register the proper rules in every model changing time. This technique can be subdivided to morphological processing and encoding technique. Nowadays, considering the state of affairs of an inspection system, the combined inspection methods are used. This hybrid type merged the advantages of the reference comparison method and the DRC method to overcome the weaknesses of each method. For example, most of the designrule verification methods are limited to verifying minimum conductor trace, angular errors, spurious copper, etc. PCB errors, which do not violate the design rules, are detected by reference comparison methods. Hence, these approaches can detect missing features or extraneous features. This technique can be subdivided to generic method, pattern detection using boundary analysis, learning methods, and circular pattern matching. In literature, it was found that only Wu et al. [5], Rudi Heriansyah [6], Khalid et al. [7-8] and Chang et al. [9], have carried out the defects classification of PCB. Wu et al. [5] have developed a PCB defects classification method based on pixel processing operation. The method is divided into two stages; defect detection and defects classification. Defect detection stage is accomplished using image subtraction procedure while the second stage is completed using three indices: (1) the type of object detected (TOD), (2) the difference in object numbers (DON), (3) the difference in background numbers (DBN) between the inspected image and the template. Rudi Heriansyah [6] has developed an algorithm using the advantages of artificial neural network to correctly classify defective PCB patterns. Neural networks have been successfully implemented in many areas, including image processing and pattern recognition related problems. Neural networks are good for adaptive pattern classification because they are easier to train and to use as compared to the traditional pattern classifiers. Based on this approach, binary morphological image processing concept and Learning Vector Quantization (LVQ) are employed to develop the algorithm. The morphological operations such as erosion, dilation, opening, and closing are used to segment PCB image into basic primitive patterns. The LVQ neural network, which consists of input, competitive layer as the first layer (hidden layer), and linear layer as the second layer (or output layer) has been selected as the classifier for the proposed technique to classify the defects that could occur on the PCB. This type of neural network has been chosen because of its ability to converge based on the training set available [6]. Khalid et al. [7-8] have developed algorithms that can categorize the defects into 5 groups. The defects of PCB are inspected from computer generated binary bare PCB images. The algorithms are performed by using MATLAB Image Processing tools such as image subtraction operation, fiood-fill operator, and NOT operation. Chang et al. [9] has developed a case-based evolutionary identification model for PCB defect classification problems. The proposed inspection system contains two phases. Phase 1 is the preprocessing stage that the PCB image with defects is retrieved and segmented into basic pattern cases to compare with a concept space stored in a case base. Phase 2 is the actual inspection and training stage.with the case-base, user can save much time in reviewing the defect. When a new defect case in
An Algorithm for Classification of Five Types of Defects on Bare Printed Circuit Board 203 found, the engineer will revise the repaired defect in the new defect case. After the user has confirmed the case solution, this case will be stores in the case base to fulfill the real-world application. 3. DEFECTS In PCB fabrication, there are several processes that must be followed. The processes are artwork master, production phototools, exposure and development of inner layers, etching of inner layers, laminating and drilling, plating through holes, exposure and development of outer layers, plating tin-lead and etch, and machine and solder mask [2]. Printing process that consists of artwork master, production phototools, and exposure and development of inner layers, which is done before the etching process, caused most of the destructive defects found on the PCB, such as short circuit and open circuit. These defects fall in fatal defects category. Meanwhile, the other defects such as pin hole, underetch, and missing hole fall in potential defects category. Fatal defects are those in which the PCB does not attend the objective they are designed for, while the potential defects are those compromising the PCB during the utilization [10]. Fig. 1 and Fig. 2 show defect free PCB image and defective image [2]. The defect free PCB image is treated to be the reference image. In this study, reference image is an original image that is no defects appeared on it. Meanwhile, the defective image is an image that has various types of defects on it. These two different types of images are needed in this study because this study chooses the image comparison technique as the vital operation in order to compare between the two images and acquire all defects on the defective image as the result. The types of defect inspected in this research are missing hole, open circuit, short circuit, pin hole, and underetch because these are only types of defects existed on real PCB before etching process is executed. Though each defect shown in the Fig. 2 is a representative example of certain defects, the shape and the size of the defects may vary from one occurrence to another. Five types of defects being considered in this study are missing hole, open circuit, short circuit, pin hole, and underetch. specifically the template image and the defective image. The method is operating by comparing both images pixel-by-pixel by XOR logic operator. The resulting image been obtained are the defects. Fig. 3 shows an example of the implementation of image difference operation. 4.2. NOT Operator NOT operator is used in this research to change the image from black to white and vice versa as shown in Fig. 4. 4.3. Flood-fill Operator The fiood-fill operator changes the colour of a region, given an initial pixel in that region on binary and grayscale images. For binary images, fiood-fill operator changes connected background pixels to foreground pixels until it reaches object boundaries. In this study, this operator is used to fill holes in a binary image as shown in Fig. 5. A hole is a set of background pixels that cannot be reached by filling in the background from the edge of the image. By default, fiood-fill uses 4- connected neighbours for 2-D inputs and 6- connected background neighbours for 3-D inputs. The simplest algorithm for the fiood-fill operator is as the following [11]: FLOOD-FILL(initial-pixel, initial-colour, finalcolour) colour (initial-pixel) = final-colour for each n Neighbours (initial-pixel) if colour(n) = initial-colour FLOOD-FILL(n,Initial-colour, final-colour); n = 8-connected neighbours 4. IMAGE PROCESSING OPERATIONS 4.1. Image Difference Operation Image difference operation is performed in order to obtain a difference image of two images, Figure 1: Template Image of Bare PCB
204 IJCSES International Journal of Computer Sciences and Engineering Systems, Vol. 5, No. 3, July 2011 The input of this algorithm is the image before fiood-fill operation and the output is the image after fiood-fill operation. The parameter used are the initial pixel, initial colour and final colour. If a hole with white fill and black pixel are the boundaries are used as the input, the initial pixel is located in the hole, with white as the initial colour. The final colour is black, same as the colour of the hole s boundaries. After the algorithm is implemented, the white fill of the hole is changed to black pixel. The output is no longer a hole, because the hole is filled with the black pixel. Figure 2: Defective Image of Bare PCB Figure 3: Image Difference Operation 4.4. Image Subtraction Operation Image subtraction operation is another method used to develop the proposed algorithm. The operation is primarily a way to discover differences between images. Subtracting one image from another effectively removes from the difference image all features that do not change while highlighting those that do. In this research, image subtraction operation uses the concept of simple subtraction and rule as shows in Table 1. Both images of template image and defective image are compared pixel by pixel. This operation will produce either negative or positive result. Therefore, the outcome of this operation is divided into two; negative image and positive image. Using binary image, 1 represents white pixel and 0 represents black pixel. In this research, the rule of defective image minus template image has been used in order to get positive and negative pixel image. 4.5. Image Addition Operation Image addition is a method for combining objects in two images into one image by using OR logic operator. Figure 4: Image Before and After NOT Operator is Applied Rule If 1-0 = 1 If 0-1 = -1 Table 1 Image Subtraction Rules Result Positive pixel image Negative pixel image Figure 5: Image Before and After fiood-fill Operator is Applied 4.6. Labelling Operation Labelling operation is another method used to obtain the defects. Labelling operation is applied in order to identify each object in a binary image.
An Algorithm for Classification of Five Types of Defects on Bare Printed Circuit Board 205 4.7. Image Separation Operation Image separation operation is applied to compare two input images and then separate objects into two output images; the first output image consists of same objects in the input images, and the second output image consists of different objects in the input images. 5. DEFECT CLASSIFICATION ALGORITHM The proposed defect classification algorithm shown in Figure 6 is developed to detect and classify the defects into five types. Those types of defects are missing hole, open-circuit, short-circuit, pin hole, and underetch. The algorithm needs two images, namely template image and defective image. In this paper, Figure 1 and Figure 2 are used as template image and defective image, respectively. At first, both images are subjected to image subtraction operation to produce negative image and positive image. In this research, defective image minus template image is used to obtain positive image and negative image respectively. Then, NOT operator and flood-fill operator are applied to the both image. From there, the algorithm continues to produce the results. Figure 6: The Proposed Algorithm 6. RESULTS AND DISCUSSIONS Based on the proposed algorithm, the resulting images are shown in Figure 7 to Figure 11. 6.1. Missing Hole Defect Missing hole defect is the first defect that has been classified. This type of defect is obtained by using several steps. Firstly, a positive image will be produced by doing image subtraction operation between template image and defective image. After that, the second image subtraction operation is applied between the template image that has gone through some processes that is two times of NOT operator and flood-fill operation with the produced positive image. The operations will produce an image that consists of missing hole defect. 6.2. Open Circuit Defect Open-circuit defect is the second defect that has been classified. This type of defect is obtained by using several steps. Firstly, a negative image will be produced by doing image subtraction operation between template image and defective image. After that, the second image subtraction operation is Figure 7: Missing Hole Defect Figure 8: Open Circuit Defect
206 IJCSES International Journal of Computer Sciences and Engineering Systems, Vol. 5, No. 3, July 2011 Figure 9: Short Circuit Defect applied between the defective image that has gone through some processes that is two times of NOT operator and flood-fill operation with the produced negative image. The operations will produce a group of defect in an image that consists of pin hole and underetch negative defect image. After that, image difference technique is performed between the group of pin hole and underetch negative defect image with the produced negative image in order to compare value of pixels for both of image. Whatever location of pixel in both of image that share the different information in kind of value of pixel, the location will be defined as the place where the open-circuit defect is located. Thus, open-circuit defect has been obtained. 6.3. Short Circuit Defect Short-circuit defect is the third defect that has been classified. This type of defect is obtained by using several steps. Firstly, a positive image will be produced by doing image subtraction operation between template image and defective image. After that, the second image subtraction operation is applied between the template image that has gone through some processes that is two times of NOT operator and flood-fill operation with the produced positive image. The operations will produce missing hole defect. After that, image difference technique is performed between missing hole defect and positive image to get underetch positive and shortcircuit defect image. Then, NOT operators, labeling process and flood-fill command are applied on the group of underetch positive and short-circuit defect image to obtain the updated image of underetch positive and short-circuit defect image. Then, image comparison operation is used to compare between the updated image and its original image in term of value of pixel. The value of pixels in the both of image will be compared one by one. Whatever location of pixel in both of image that share the different information in term of value of pixel, the location will be defined as the place where the shortcircuit defect is located. Thus, short-circuit defect has been obtained. 6.4. Pin Hole Defect Pin hole defect is the forth defect that has been classified. This type of defect is obtained by using several steps. Firstly, a negative image will be produced by doing image subtraction operation between template image and defective image. After that, the second image subtraction operation is applied between the defective image Figure 10:Pin hole Defect Figure 11:Underetch Defect
An Algorithm for Classification of Five Types of Defects on Bare Printed Circuit Board 207 that has gone through some processes that is two times of NOT operator and flood-fill operation with the produced negative image. The operations will produce a group of defect in an image that consists of pin hole defect and underetch negative defect image. Then, labeling operation is applied to the image and the updated image that consists of pin hole and underetch negative defect image will be produced. Next step is image comparison operation is used. Image comparison operation is functioning to compare between the updated image and its original image in term of value of pixel. The value of pixels in all locations in the both of image will be compared one by one. Whatever location of both of image that share the same information in kind of value of pixel, the locations will be defined as the place where the pin hole defect is located. This definition of location for pin hole defect only will be true if an assumption has been made, that is there will be just pin hole defect in the resulting image. Other defects like breakout and other defects are considered to be not existed in the group of underetch negative and pin hole image. Thus, pin hole defect has been obtained. 6.5. Underetch Defect Underetch is the last type of defect that has been classified. This type of defect is obtained by using several steps. Firstly, a positive image and a negative image will be produced by doing image subtraction operation between template image and defective image. After that, image subtraction operation image subtraction operation is applied between the template image that has gone through some processes that is two times of NOT operator and flood-fill operation with the produced positive image. The operations will produce an image that consists of missing hole defect. Meanwhile, image subtraction operation image subtraction operation also is applied between the defective image that has gone through some processes that is two times of NOT operator and flood-fill operation with the produced negative image. The operations will produce a group of defect in an image that consists of pin hole and underetch negative defect. After that, image difference technique is performed between the missing hole defect image and positive image to get underetch positive and short-circuit defect image. Then, NOT operators, labeling process and flood-fill command are applied on the group of underetch positive and short-circuit defect image to obtain the updated image of underetch positive and short-circuit defect image. Then, image comparison operation is used to compare between the updated image and its original image in term of value of pixel. The value of pixels in all locations in the both of image will be compared one by one. Whatever location in both of images that share the different information in term of value of pixel, the locations will be defined as the place where the underecth positive defect is located. Thus, underetch positive defect has been obtained. At the other hand, labeling operation is applied to the image that consists of pin hole and underetch negative. This operation will be produced the updated image of pin hole and underetch defect image. Next step is image comparison operation is used. Image comparison operation is functioning to compare between the updated image and its original image in term of value of pixel. The value of pixels in all locations in the both of image will be compared one by one. Whatever location in both of image that share the different information in kind of value of pixel, the coordinates will be defined as the place where the underetch negative is located. Thus, underetch negative has been obtained. Underetch defect can be obtained by using image addition operation to underetch negative image and underetch positive image that have been obtained previously. 7. CONCLUSIONS In this research, we use the referential method which can detect the defects of the PCB and then classify them separately. The result showed that the proposed algorithms can detect missing hole, wrong size, open-circuit, short-circuit, pin hole, and underetch. However this research has major limitation of its algorithms in term of images that have been processed. Binary images have been used in implementing the algorithms, whereas the output from CCD cameras is in grayscale format [6]. Thus, this study should be improved by using the grayscale image format. Because of the grayscale image format issue, the proposed algorithm could be integrated with a vision system consists of CCD camera, frame grabber and personal computer.
208 IJCSES International Journal of Computer Sciences and Engineering Systems, Vol. 5, No. 3, July 2011 In order to grab picture and process the template and defective image, there are some issues that must be solved. First issue is translational and rotational matching between template image and defective image. Thus, there should be a kind of method to make sure template and defective image is one hundred percent match each other. So that, unwanted noise issue can be reduced. Hopefully, the true performance of the proposed algorithms can be proven and unquestionable by following all the ways that have been mentioned before. REFERENCES [1] J. Hong, K. Park, and K. Kim, Parallel Processing Machine Vision System for Bare PCB Inspection, in Proceedings of the 24th Annual Conference of the IEEE Industrial Electronics Society, 1998, 3, 1346-1350. [2] M. Moganti, F. Ercal, C. H. Dagli, and T. Shou, Automatic PCB Inspection Algorithms: A Survey, Computer Vision and Image Understanding, 63(2), 1996, 287-313. [3] R. S. Guh and J. D. T. Tannock, A Neutral Network Approach to Characterize Pattern Parameters in Process Control Charts, Journal of Intelligent Manufacturing, 10(5), 1996, 449-462. [4] Y. Sun and C. Tsai, A New Model-Based Approach for Industrial Visual Inspection, Pattern Recognition, 25, 1992, 1327-1336. [5] W. Wu, M. J. Wang and C. M. Liu, Automated Inspection of Print Circuit Boards Through Machine Vision, Computers in Industry, 28, 1996, 103-111. [6] R. Heriansyah and S. A. R. Abu-Bakar, Defects Classification on Bare PCB using Multiple Learning Vector Quantization Neural Network Paradigm, in International Conference on Computer Graphics, Imaging, and Visualization, 2004, 50-53. [7] N. K. Khalid and Z. Ibrahim, An Image Processing Approach Towards Classification of Defects on Printed Circuit Board, in Malaysia-Japan International Symposium on Advanced Technology, 2007. [8] N. K. Khalid, Z. Ibrahim, and M. S. Zainal Abidin, An Algorithm to Group Defects on Printed Circuit Board for Automated Visual Inspection, International Journal of Simulation: Systems, Science, and Technology, 9(2), 2008, 1-10. [9] P. C. Chang, L. Y. Chen, and C. Y. Fan, A Case-Based Evolutionary Model for Defect Classification of Printed Circuit Boards Images, Journal of Intelligent Manufacturing, 19, 2008, 203-214. [10] M. H. Tatibana and R. de A. Lotufo, Novel Automatic PCB Inspection Technique Based on Connectivity, Computer Graphics and Image Processing Proceedings, 1997, 187-194. [11] J. Silvela and J. Portillo, Breadth-First Search and Its Application to Image Processing Problems, IEEE Transactions on Image Processing, 10(8), 2001.