Wavelet-Based Printed Circuit Board Inspection System Zuwairie Ibrahim and Syed Abdul Rahman Al-Attas Abstract An automated visual printed circuit board (PCB) inspection system proposed in this paper is designed specifically to detect various types of defects occurred during circuit printing process in manufactory. Two-dimensional HAAR wavelet transform is incorporated in the PCB inspection algorithm of the inspection system. During the inspection, two type of images are required; reference and tested PCB images. The wavelet transform is applied to the reference and tested PCB images. According to previously proposed wavelet-based PCB inspection algorithm, a reference comparison between the reference and tested PCB images has been done in wavelet domain by employing image difference operation. However, in practice, this operation also bring along the unwanted noise due to misalignment and uneven binarization. Thus, in this paper, for the real-time implementation, the image difference operation between the reference and tested PCB images is replaced with image subtraction. The output of the image subtraction operation can be differentiated as positive, negative, and zero images. By doing so, a noise elimination procedure is applied to positive and negative images, resulting noise free positive and negative images. Lastly, the noise free images are subjected to XOR logic operation to generate the output of the inspection system. During the manufacturing process, since etching usually contributes most destructive defects found on PCBs, it is important to perform the proposed automated visual PCB inspection after the circuit printing and before the etching process. Keywords Automated visual inspection system, HAAR wavelet, image difference, image subtraction, noise elimination, printed circuit board. T I. INTRODUCTION HERE exist numerous numbers of algorithms, techniques, and approaches reported in the area of automated visual PCB inspection to date. As stated by Moganti et al. [1], these can be divided into three main categories: referential approaches, rule-based approaches, and hybrid approaches. Manuscript received April 3, 2004. This work was supported under Intensification of Research in Priority Areas (IRPA) No. 72396. Zuwairie Ibrahim was with the Computer Vision, Video, and Image Processing Research Group (CVVIP), Department of Microelectronics and Computer Engineering, Faculty of Electrical Engineering, Universiti Teknologi Malaysia, 81310 Skudai, Johor Darul Takzim, Malaysia. He is now pursuing his PhD at the Institute of Applied DNA Computing, Meiji University, Kanagawa, 214-8571 Japan (phone: +81-44-934-7377; fax: +81-44-934-7909; e-mail: zuwairie@isc.meiji.ac.jp). Syed Abdul Rahman Al-Attas is with the Computer Vision, Video, and Image Processing Research Group (CVVIP), Department of Microelectronics and Computer Engineering, Faculty of Electrical Engineering, Universiti Teknologi Malaysia, 81310 Skudai, Johor Darul Takzim, Malaysia (e-mail: syed@fke.utm.my). Referential approaches consist of image comparison and model-based techniques. Image comparison technique simply compares the tested PCB image against the reference PCB image using simple XOR logic operator [2]. Model-based technique, on the other hand, matches the tested PCB image by using a predefined model [3]. Rule-based approaches test the design rule of the PCB traces to determine whether each PCB trace fall within the required dimensions or not. Mathematical morphological operation is frequently used where dilation and erosion are basic operation [4]. Lastly, hybrid inspection approaches combines the referential approaches and design-rule approaches to make use the advantages and overcome the shortcomings of each approach. In the previous research work on the automated visual PCB inspection, we investigated a new PCB inspection technique, which is based on wavelet transform [5], [6]. The proposed wavelet-based PCB inspection algorithm falls in the referential approaches under the model-based techniques. As a result, from the simulation point of view, the inspection time of the proposed method showed a significant improvement compared to another methods, within the same category [7], [8]. In this paper, a real-time implementation of wavelet-based PCB inspection is realized. According to the previous research work, a reference image and a tested image are subjected to wavelet transform and image difference operation is employed to the second level approximation image of wavelet transform. One disadvantage of this approach is that during the real-time implementation, this operation normally contributes unwanted noise due to misalignment and uneven binarization and thus, the accuracy of the defect detection could be decreased. Hence, it is critically important to design a noise elimination procedure in order to eliminate, if possible, or rather to reduce as much as possible the noise cause by image difference operation. It has been discovered that if the image difference operation is behaved as image subtraction operation, the noise interferes in the output image is actually the combination of noise occurred in the positive and negative images. Note that after the image subtraction, three types of data are produced: positives, negatives, and zeros values of data. Only the two-dimensional data, images, of positive and negative contain the undesired noise, if any, and the zeros one did not affect the output of the algorithm. Due to this argument, one possible way to reduce the noise is by separating the image difference output into the positive and negative image by using image subtraction and then, a noise elimination procedure is applied to the positive and negative images in order to remove unwanted noise 73
occurred in the images. Next, the noise free positive and negative images are combined together to produce the output of the inspection. Before the image difference operation is utilized, it is also important to bring the location of the tested and reference images as same as possible. In this paper, the manually mechanical and software approaches are employed for the alignment purpose. admissibility constant. According to Mallat [11], the continuous wavelet transform (CWT) of a function f is given by: f 1 a t b a a b f t dt, [2] II. DEFECTS A variety of defects can affect the copper pattern of PCB. Some of them are identified as functional defects, whereas the others are visual defects. Functional defects seriously cause damage to the PCB, meaning that the PCB does not function as needed. Visual defects do not affect the functionality of the PCB in short term. But in long period, the PCB will not perform well since the improper shape of the PCB circuit pattern could contribute to potential defects. Thus, it is crucial to detect these two types of defects in the inspection phase. Fig. 1 shows an artificial defect-free PCB image pattern. Fig. 2 shows the same image pattern as in Fig. 1 with a variety of defects on it. The printing defects and anomalies that will be looked at, for example, are breakout, short, pin hole, wrong size hole, open circuit, conductor too close, underetch, spurious copper, mousebite, excessive short, missing conductor, missing hole, spur and overetch. These defects are shown in Fig. 2. 1. Breakout 2. Pin Hole 3. Open Circuit 4. Underetch 5. Mousebite 6. Missing Conductor 7. Spur 8. Short 9. Wrong Size Hole 10. Conductor Too Close 11. Spurious Copper 12. Excessive Short 13. Missing Hole 14. Overetch Figure 2: An example of defective PCB pattern Figure 1: An example of good PCB pattern. III. WAVELETS Wavelet is a zero mean function [9] and satisfies the so-called admissibility condition [10]: 2 ˆ ( ) C d where is a fixed function, called mother wavelet and is the Fourier transform of. The constant C designates the [1] The parameter denotes the dilation factor and has a constraint such that > 0 and b, a real number, is the translation parameter. Wavelet transform decomposes a signal f(t) into many coefficients, which are the function of scale (dilation) and position (translation). The computation of the wavelet transform of a two-dimensional signal, an image, is applied as a successive convolution by a filter entry of row/column followed by a column/row as depicted by Fig. 3. As for two-dimensional wavelet transform, after the first level wavelet transform operation, the input image can be divided into 4 parts: approximation, horizontal detail, vertical detail and diagonal detail where the size of each part is reduced by the factor of two compared to the input image as depicted by Fig. 4. Approximation is a compressed and coarser part than the original input image. Meanwhile, the horizontal detail, vertical detail and diagonal detail contain the horizontal, vertical and diagonal components of the input image. When the second level wavelet transform is applied, the approximation part of the first level will be further decomposed into four components as depicted by Fig. 5. For the higher level, the iteration is done in the same way until the desired level is reached. HAAR wavelet has two filter entries [12] as shown in Table 1. By using the HAAR wavelet for wavelet-based image 74
difference algorithm, no boundary solution is required. Also the computation of wavelet transform can be applied as a moving average operation within the original image. Original signal TABLE I ANALYSIS FILTER FOR HAAR WAVELET Coefficient 1 Coefficient 2 Approximation (low pass) filter 1/2 1/2 Detail (high pass) filter 1/2 1/2 Successive convolution of the signal with a low-pass filter of 4 entries Successive convolution of the signal with a high-pass filter of 4 entries Figure 3: Successive convolution of wavelet transform. named as Img1, Img2, and Img3 of size M x N where M is the length and N is the height of the image respectively. The parameter x, denotes the column of the image, from 1 to M, and parameter y, denotes the row of the image, from 1 to N where both x and y are integers. Every pixel in the Img1, Img2, and Img3 are denoted by Img1[x,y], Img2[x,y] and Img3[x,y] respectively. Img1 and Img2 are the input to the image subtraction operation, whereas the Img3 is created as a place to store the output values. Initially, x and y are set to 1. Therefore; for every x (1,M) { for every y (1,N) { Img3[x,y] = Img1[x,y] Img2[x,y]; } } Figure 4: The concept of first level wavelet transfom. Figure 5: The concept of second level wavelet transform. IV. IMAGE SUBTRACTION OPERATION As mentioned previously, during the real-time implementation, the image difference operation that is employed in the wavelet-based PCB inspection algorithm is replaced by image subtraction operation. Consider three images V. REAL TIME IMPLEMENTATION AND NOISE ELIMINATION PROCEDURES Two images are needed for the inspection, the reference image and the tested image as shown in Fig. 6 and Fig. 7 respectively. These images, in gray scale, are captured from the reference and inspected PCB laminate by a high-resolution monochrome CCD camera. Second level HAAR wavelet transform is applied to the reference image and then the image and also the wavelet outputs are stored in memory. This step is done offline once only during set up process as indicated by dash line in Fig. 8. For the tested image, as same as the reference image, second level HAAR wavelet transform is calculated. The approximation part obtained from the second level wavelet transform is named as coarse image. The advantage of wavelet transform is that it preserves most of the information of the original image in the coarse image. Thus, it is possible to detect all the defects by applying image subtraction operation between the coarse reference image and coarse tested image. In the inspection system, the alignment of PCB is realized by manually mechanical and software techniques by using mvt_search_train and mvt_smrt_search command available in MVTools. The PCB alignment also can be done automatically by utilizing a mechanical device as well. But the subtracted image still could be interfered by unwanted noise due to slightly misalignment and uneven binarization. Hence, it is difficult to reduce or diminish the noise in the output image. In order to make the noise elimination easier, the subtracted image is break up to a positive and negative image as shown in Fig. 9 and Fig. 10. 75
Fig. 11 and Fig. 12 show the filtered positive and negative image in binary after the noise elimination process respectively. Figure 6: An example of reference PCB image. Figure 8: Image subtraction operation for the generation of positive and negative image. Figure 7: An example of defective PCB image. The generated positive and negative images are binarized and then subjected to a noise elimination procedure. The noise elimination is executed by examining each object pixels by a 3x3 window for the positive and negative images. At every location, the number of foreground pixel, is calculated and tested whether it is greater than or equal to the specified threshold,. If it is greater than or equal to the threshold value, then the object pixels represent the defective pixels in the subtracted image and should be preserved. Otherwise, the object pixels are belonging to noise and must be cleared. Based on the experiments, the suitable threshold value is set to 6. Figure 9: Positive image. 76
Figure 10: Negative image. Figure 12: Filtered negative image. Missing Hole Short Missing Conductor Spur Figure 11: Filtered positive image. Figure 13: An output of the inspection system. 77
Course Resolution Reference PCB Image Course Resolution Tested PCB Image Image Subtraction Operation Positive Image Negative Image Threshold Threshold for every object pixel in 3x3 window; calculate the number of object pixel, if < then delete the object pixel for every object pixel in 3x3 window; calculate the number of object pixel, if < then delete the object pixel Noise Free Positive Image Noise Free Negative Image XOR Defect Figure 14: Noise elimination procedure. The next step is to combine the noise free positive and negative images by simply applying the XOR logic operator. The output of the XOR logic operation is the final result of the inspection process. The output image is enlarged by a factor of 4 to convert it back as the same size of input image. The output of the inspection system is illustrated in Fig. 13. The flow of the noise elimination procedure, incorporated in the wavelet-based PCB inspection system is shown in Fig. 14. The proposed wavelet-based automated visual PCB inspection system is implemented on a Pentium III 800 MHz microcomputer facilitated with a PCVISION Plus frame grabber. The images are captured by a 1k x 1k pixels UNIQ monochrome CCD camera. MVTools machine vision library based on Visual C++ is used for programming. The inspection system also consists of a lighting devices and several camera lens for a good quality of captured images. The result of processing part can be displayed via a monitor to the users or operators. The output image of the inspection system showed that all the defects occurred were successfully detected. The overall computation time is about 1852 milliseconds. Computation time could be improved further by advancing the performance of the computer employed or by implementing the inspection procedure on high performance computing platform, such as in FPGA or DSP processor. VI. CONCLUSIONS The previously proposed wavelet-based PCB inspection approach is implemented to inspect in real-time, the real PCB laminates taken after the printing process. During the implementation, the proposed approach consists of point-to-point image difference operation and suffers from the unwanted noise due to misalignment and uneven binarization. Hence, a noise elimination procedure is designed and developed as well in such a way that the positive and negative images are acquired from image subtraction operation and the noise elimination is applied to the positive and negative images, individually. The resultant images are combined to produce the output of the inspection system. It is expected that the proposed PCB inspection system is well suited for small and medium scale PCB manufacturers where the sophisticated alignment facilities is hard to purchase. Three samples were used for testing and as a result, the proposed PCB inspection system is expected to be use for online detection of the 14 types of printing defects occurred during the circuit printing process. The prototype of the inspection system is available at the Faculty of Electrical Engineering, Universiti Teknologi Malaysia, Johor, Malaysia. The correctness and effectiveness of the proposed noise elimination design has been 78
demonstratedduring the Science and Technology Exhibition 2002, Putra World Trade Centre, Kuala Lumpur, Malaysia. REFERENCES [1] M. Moganti, F. Ercal, C. H. Dagli, and S. Tsunekawa, Automatic PCB inspection algorithms: a survey, Computer Vision and Image Understanding, vol. 6, no. 2, 1996, pp. 287-313. [2] W. Wen-Yen, J. Mao-Jiun, J. Wang, and L. Chih-Ming, Automated inspection of printed circuit board through machine vision, Computers in Industry, vol. 28, issue 2, 1996, pp. 103-111. [3] J. H. Koo and S. I. Yoo, A structural matching for two-dimensional visual pattern inspection, IEEE International Conference on Systems, Man, and Cybernetics, vol. 5, 1998, pp. 4429-4434. [4] S. H. Oguz and L. Onural, An automated system for design-rule-based visual inspection of printed circuit boards, Proceedings of the IEEE International Conference on Robotics and Automation, 1991, pp. 2696-2701. [5] Z. Ibrahim, S.A.R. Al-Attas, and Z. Aspar, Model-based PCB inspection technique using wavelet transform, Proceedings of the 4th Asian Control Conference, Singapore, 2002. pp. 2026 2029. [6] Z. Ibrahim, Printed circuit board inspection using wavelet-based technique, M. Eng. Thesis: Universiti Teknologi Malaysia. Jun 2002. [7] Z. Ibrahim, S.A.R. Al-Attas, Z. Aspar, and M. M. Mokji, Performance evaluation of wavelet-based PCB defect detection and localization algorithm, IEEE International Conference on Industrial Technology, Bangkok, 2002, pp. 226 231. [8] Z. Ibrahim, S.A.R. Al-Attas, and Z. Aspar, Analysis of the wavelet-based image difference algorithm for PCB inspection, Proceedings of the 41st SICE Annual Conference, 5-7, 2002, Osaka, pp. 1525-1530. [9] C. Torrence and G. P. Compo, A practical guide to wavelet analysis, Bulletin of the American Meteorological Society, 1998, pp. 61-78. [10] R. L. Rao, Multiresolution technique in image processing, PhD Thesis: Lousiana State University, 1995. [11] S. Mallat, Wavelet for a vision, Proceeding of the IEEE: Special Issue on Wavelets, vol. 84, no. 4, 1996, pp. 604-614. [12] E. J. Stollmitz, T. D. Derose, and D. H. Salestin, Wavelets for a computer graphic: a primer, part 1, IEEE Computer Graphics and Applications, vol. 15, no. 3, 1995, pp. 76-84. Zuwairie Ibrahim received the B.Eng (Mechatronics) and M.Eng. (Image Processing) from Universiti Teknologi Malaysia, Malaysia, in 2000 and 2002 respectively. Since 2002, he engaged with Department of Mechatronics and Robotics, Universiti Teknologi Malaysia as a lecturer. He is currently pursuing his PhD at the Institute of Applied DNA Computing, Meiji University, Kanagawa, Japan. He is a student member of Institute of Electrical and Electronics Engineers (IEEE), International Computational Intelligence Society (ICIS), and International Signal Processing Society (ISPC). His research interests include signal and image processing, automated visual inspection, evolutionary and unconventional computing such as molecular or DNA computing. Syed Abdul Rahman Al-Attas received the M.S. degree in 1991 and the PhD degree in 1997, from the Georgia Institute of Technology, USA and University of Bradford, United Kingdom, respectively. He is currently an Associate Professor of Department of Microelectronics and Computer Engineering, Universiti Teknologi Malaysia, Malaysia and Head of Computer Vision, Video, and Image Processing Research Group (CVVIP). He is a member of Institute of Electrical and Electronics Engineers (IEEE). His research interests include the application of machine vision and image processing particularly in moving object detection for security surveillance, automated visual inspection system, and fingerprint classification. 79