National Conference on Future Aspects of Artificial intelligence in Industrial Automation (NCFAAIIA 2012) Proceedings published by International Journal of Computer Applications® (IJCA) 20 Machine Vision algorithm for PCB Parameters Inspection Sharat Chandra Bhardwaj ECE, Graphic Era University Clementown, Dehradun ABSTRACT An Automated Optical Inspection (AOI) algorithm for printed circuit board (PCB) inspection system proposed in this paper. The proposed method detect holes defect that occur during PCB etching process during manufacturing. The object of PCB inspection algorithm is to develop a more reliable and faster visual inspection system. The inspection process contains two stages, namely, measurement stage and detection stage. In the first stage, only one image feature is measured from the examined image and is used for detection of defects. General Terms Image inspection, Image processing, Parameter Extraction Keywords AOI, PCB Defects, Image Morphology, Particle analysis, Particle measurement 1. INTRODUCTION Automated optical inspection (AOI) technology is making significant progress as PCB designs continue to pack in more circuitry per square inch and create new inspection challenges. The common goal among AOI system manufacturers is to improve lighting, computing power, and vision software. These improvements make AOI products more intelligent, flexible, and with far more repeatable results that are superior to human visual inspection. For finding of errors in PCB many algorithms are proposed by authors. There are many different errors in printed circuit boards. Automatic optical inspection (AOI) systems are widely adopted in industrial applications [1-3]. There are many algorithms, techniques, and approaches developed in the area of automated visual PCB inspection. By Moganti et al. [4], these can be broadly classified into three categories: referential, rule based, and hybrid approaches. The referential approaches consist of image comparison algorithms. Image comparison technique simply compares the tested PCB image to the reference PCB image using simple XOR logic operator [5].in the Model-based technique, PCB image is matched by using a predefined set of referential data base [6]. Rule-based approache looks for the design rule of PCB to detect whether PCB trace fulfills the required dimensions or not. Also mathematical morphological operation is used where dilation and erosion are basic operation [7]. Lastly, the hybrid inspection approaches combines the referential and design rule approaches to overcome the shortcomings of each approach. 2. PCB DEFECTS In the manufacturing process of PCB, there are some defects commonly present. During the first process that is etching the anomalies occurring on bare PCB. These defects can be classified into two categories, potential and fatal defects. Fatal defects are those in which the PCB does not fulfil the design rules or specifications, while the potential defects are those which compromise the PCB performance during utilization. In fatal defects category short-circuit and open-circuit defects are there. Breakout, under etch, missing hole, and wrong size hole fall in potential defects category. The incomplete etching process leaves unwanted conductive materials and forms defects like short-circuit, extra hole, protrusion, island, and small space. Excessive etching leads to open-circuit and thin pattern on PCB [8], [9]. In addition, some other defects may exist on bare PCB, i.e. missing holes, scratch, and cracks [10]. 3. METHODOLOGY FOR PCB INSPECTION 3.1 Extraction of Color Planes from RGB image The number of planes in an image corresponds to the number of arrays of pixels that compose the image. A greyscale or pseudo-color image is composed of on plane. A true-color image is composed of three planes- one each for red component, green component and blue component i.e. the color component intensities of a pixel are coded into three different values. Thus, a color image is the combination of three arrays of pixels corresponding to red, green and blue in an RGB image. The following equations convert an RGB image into a grayscale image on a pixel-by-pixel basis [11]. Grayscale value = 0.299R + .587G + 0.114B An alternative conversion from RGB to grayscale is a simple average: grayscale value = (R + G + B) / 3 3.2 Pre-processing using Image filters Please Filters are used to prepare an image for processing so we can extract only the information needed from the image. Most of these filters apply a kernel across the image. A kernel represents a pixel and its relationship to neighboring pixels. The weight of the relationship is specified by the coefficients of each neighbor [11] Smoothing-Low pass: Low pass filtering. smooth images by eliminating details and blurring edges. Smoothing-Local Average: Local averaging of the image pixels based on the kernel. Smoothing-Gaussian: Gaussian filtering based on the kernel. Attenuate the variations of light intensity in the neighborhood of a pixel. 3.3 Conversion of image from Grayscale to Binary To convert grayscale image into binary, thresholding of image is done. Thresholding consists of segmenting an image into two regions: a particle region and a background region. This process works by setting to 1 all pixels that belong to a gray-level interval, called the threshold interval, and setting all other pixels in the image to 0. Use thresholding to isolate objects of interest in an image [11]. Thresholding converts the image from a grayscale image, with pixel values ranging from 0 to 255, to a binary image, with pixel values of 0 or 1. Thresholding enables to select ranges of pixel values in grayscale and color images that separate the objects under