PCB is an indispensable and important pillar in the information industry. As the basic components of various electronic products and the information carrier that integrates various electronic components, PCB has developed rapidly in the direction of high performance, high speed, light, thin, short and small. Technology and complexity have reached a very high level. Therefore, with the continuous expansion of the PCB field, the importance of PCB is further increased.
In the process of sampling, quantization, and transmission of the gray-scale image of the PCB to be measured, due to uneven changes in illumination, the sensor noise of the charge-coupled device (CCD, Charge-Coupled Device) camera itself, and analog-to-digital acquisition (AD, Analog- The quantization noise of the to-Digital) process, the grain noise produced by the photosensitive process, and the slight jitter caused by human factors, etc.,
the image obtained during the transmission and reception processing is inevitably affected by the internal components and the external environment, which will cause the image quality to be distorted. The signal-to-noise ratio drops. In order to reduce noise, you can use a smoothing filter to filter the image to be tested, but choosing smoothing filters of different sizes will blur the processed image to different degrees. Therefore, to improve the quality of the image, the filter used can not only effectively remove the noise. And can preserve the original appearance of the image as much as possible.
1 Image enhancement
Image enhancement is a technology to improve image quality. Compared with a pre-processing of image recognition, it can be divided into two categories: spatial domain processing and frequency domain processing according to the spatial difference of image enhancement processing. The former includes the gray-scale effect on the image. As well as the histogram correction, the pixel gray value is directly processed; the latter is to analyze the spectral components of the image, after Fourier transform, the high frequency and low frequency parts of the image spectrum are processed, and then the inverse Fourier The leaf transform obtains the desired image result.
1.1 Grayscale transformation in spatial domain
As an important method of image enhancement, grayscale transformation can increase the dynamic range of the image, expand the contrast of the image, and make the image characteristics more obvious to improve the image display effect. Gray scale transformation can be divided into linear transformation and non-linear transformation.
Due to overexposure or underexposure, the grayscale of the PCB image collected by the CCD may vary within a small range, and the computer may see no grayscale and blurred images. Using linear transformation can linearly stretch the grayscale of each pixel of the blurred image, which can effectively improve the visual effect of the image.
1.2 Image smoothing in spatial domain
The purpose of image smoothing is to reduce and eliminate image noise to improve image quality for subsequent processing such as image segmentation and image recognition. In the spatial domain, you can use neighborhood averaging to reduce noise; in the frequency domain, because the frequency spectrum of high-frequency noise is more likely to occur, various forms of low-pass filtering can be used. In the spatial domain, image smoothing mainly includes methods such as noise threshold, neighborhood average, weighted average, and median filtering.
1.2.1 Noise threshold
The noise threshold method is a common noise elimination method, which has high efficiency in noise execution and is simple and easy to eliminate. When it smooths the image, the first is the setting of the threshold threshold. The setting of the threshold threshold directly affects the filtering effect and image details. Then, according to the characteristics of the image, each pixel is detected sequentially, according to the formula and all of its neighborhood. The pixel values are compared to determine whether the pixel is noise. If it is not noise, the original value of the pixel is output; if it is noise, the output is the average value of the gray levels of other pixels in the neighborhood. The selection of the threshold T in this method is very important. If T is too large or too small, it will more or less cause the noise to be insufficiently smoothed or the image to become blurred.
1.2.2 Median filtering
The traditional median filter algorithm is mainly focused on the sorting of window data. In order to reduce the number of permutations and get the median faster, a fast median filter algorithm is proposed, which decomposes the array into a one-dimensional array for operation, and takes the array level first. The median value of each line, and then the median value of the median value of each horizontal line is taken as the final output of the filtering.
1.2.3 Fast weighted median filter
In order to solve the contradiction of not only reducing noise, but also protecting PCB image details, this paper proposes a fast weighted median filter algorithm, which not only improves the filtering speed, but also filters out noise well, but also protects more images. detail.