Precision PCB Fabrication, High-Frequency PCB, High-Speed PCB, Standard PCB, Multilayer PCB and PCB Assembly.
The most reliable PCB & PCBA custom service factory.
PCB Blog

PCB Blog - Research and Implementation of Image Preprocessing Based on PCB Board

PCB Blog

PCB Blog - Research and Implementation of Image Preprocessing Based on PCB Board

Research and Implementation of Image Preprocessing Based on PCB Board

2022-02-23
View:637
Author:pcb

In order to improve the image quality of the printed circuit boards, for the subsequent improvement of the recognition rate of the PCB board image, the original image was pre-processed by using the MATLAB language, mainly including the grayscale transformation of the image space domain and the Image smoothing filtering to remove noise. Firstly, the noise threshold, median filter and fast median filter methods are studied, and a fast weighted median filter algorithm is proposed. The image is processed by MATLAB, and the gray histogram and spectrogram are compared and analyzed. The results show that the fast weighted median filter is used. The filtering algorithm solves the problems of poor contrast, large noise and blurred details of PCB board images, which greatly improves the image quality. In the information industry, the PCB board is an indispensable pillar. As the basic components of various electronic products and the information carrier integrating various electronic components, the PCB board has developed rapidly towards the direction of high performance, high speed, light, thin, short and small., its technology and complexity have reached a very high level. Therefore, with the continuous expansion of the PCB board field, the importance of the PCB board is also further increasing. During the sampling, quantification, and transmission process of the grayscale image to be measured on the PCB, due to uneven changes in illumination, sensor noise of the charge-coupled device (CCD, Charge-Coupled Device) camera itself, and analog-digital acquisition (AD, Analog -to-Digital) process quantization noise, particle noise generated by the photosensitive process, and slight jitter caused by human factors, etc., the images obtained during transmission and reception are inevitably affected by internal devices and external environments, thus distorting the image quality., the signal-to-noise ratio decreases. In order to reduce noise, a smoothing filter can be used to filter the image to be tested, but the selection of smoothing filters of different sizes will have different degrees of blurring of the processed image. Therefore, to improve the quality of the image, the filter used can not only effectively remove noise and preserve the original appearance of the image as much as possible.

Printed circuit boards

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 different space of image enhancement processing. The former includes the gray level effect on the image. and histogram correction, all directly process the pixel gray value; the latter is to analyze the spectral components of the image, and after Fourier transform, the high-frequency and low-frequency parts of the image spectrum are processed, and then the inverse Fourier is performed. Leaf transform to obtain the desired image result. Due to external exposure and other interference factors in the channel transmission process, the collected PCB board image reduces the brightness of the image and increases the noise. In order to effectively eliminate noise interference and enhance the contrast between light and dark of the image, this paper is to be tested on the PCB board. Grayscale transformation processing and image smoothing processing of selected spatial domain in image enhancement.

1.1 Grayscale transformation in spatial domain
As an important means of image enhancement, grayscale transformation can increase the dynamic range of the image, expand the contrast of the image, and make the image features more obvious to improve the image display effect. Grayscale transformation can be divided into linear transformation and nonlinear transformation. Let the grayscale range of the original image m (x, y) be [a, b], and the gray scale of the linearly transformed image n (x, y) will be extended to [c,d], the relationship between them is: due to over 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 blurry image. The use of linear transformation can linearly stretch the grayscale of each pixel of the blurred image, which can effectively improve the visual effect of the image. In order to improve the post-processing and feature extraction of image recognition, the original PCB board image is first subjected to binary grayscale processing, and then the image domain method of histogram correction technology is used to equalize 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, neighborhood averaging can be used to reduce noise; in the frequency domain, various forms of low-pass filtering can be used due to the greater probability of noise spectrum in high frequency bands. In the spatial domain image smoothing mainly includes noise threshold, neighborhood average, weighted average, median filter and other methods.

1) Noise threshold
The noise threshold method is a common noise removal method, which has high efficiency for noise and is simple and easy to remove. When it smoothes the image, it is the setting of the threshold. The setting of the threshold directly affects the filtering effect and image details. Then, according to the characteristics of the image, each pixel is sequentially detected, and all the pixel values in its neighborhood are based on the formula. Compare and judge 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 value T in this method is very important. If T is too large or too small, it will more or less lead to insufficient noise smoothing or blurred images.
1.2.2 Median Filtering
The traditional median filtering algorithm mainly focuses on the sorting of the window data. In order to reduce the number of permutations and obtain the median faster, a fast median filtering algorithm is proposed. The array is decomposed into a one-dimensional array for operation, and the array level is first taken. The median value of each row is taken, and then the median value of the median value of each horizontal row is taken as the output of the filter.

2) Fast weighted median filter
In order to solve the contradiction between noise reduction and protection of image details, a fast weighted median filtering algorithm is proposed in this paper, which not only improves the filtering speed, the noise is well filtered, but also protects more image details. . By weighting, the proportion of the central pixel in the window is increased. For the input: I1 I2,,, IN), the output weighted median filter: r represents the weight, MED{} represents the median operation function, and specifies that W=( 1, 1, 1) is the standard window. Provision: where T is the threshold function, when W is an integer, the number of weighted output components in 1 1 {WrI,2 2 } NNW rI W rI : Fast weighted median filtering The operation process of median operation MED is: First, sort the cN numbers in the weighted output in ascending order, and the T-th number of the cN numbers output after sorting is the median output.

2. MATLAB image enhancement processing
MATLAB supports 5 image types including index image, grayscale image, binary image, RGB image and multi-frame image array; the collected PCB board image can be enhanced with contrast first, and then denoised. The original noise of the image is also greatly increased in the process of enhancing the contrast, so that the subsequent image denoising processing cannot achieve good results. Therefore, in this paper, the image is first denoised and then enhanced. On the collected PCB board image, there may be noise that needs to be denoised, the light source intensity is not enough, and the image may be dark as a whole. First, use the RGB2GRAY function to convert the collected image to grayscale The image (256 colors) is compared with the method proposed in this paper and the traditional median filtering method for the PCB image containing salt and pepper noise. After denoising, grayscale transformation is used to enhance the PCB image. The brightness of the amplitude spectrum reflects the amplitude of each frequency component, and the energy of the image is mainly concentrated in the low frequency band (central part). Although the high frequency band contains a small amount of energy, it contains important information of the image. The edge information of the image belongs to the high frequency information. Similarly, the gray level of the noise changes rapidly and is also the high frequency information. It can be seen from the figure that both filtering methods suppress the high-frequency components of the image to a certain extent, and can effectively filter out the noise in the high-frequency band, but the low-frequency components, that is, the part where the grayscale changes gently, the image contour information is affected. It can also be seen from the histogram that the slowly changing gray levels of 150-200 have been destroyed, and the weighted median can well protect the contour information. It can be seen from the histogram after grayscale processing that the histogram occupies the allowable range of the grayscale value of the entire image, which increases the dynamic range of the grayscale of the image, and also increases the contrast of the image, and has a greater visual contrast in the image. to make the details stand out more.

3. Conclusion
In this paper, the collected PCB board images are generally dark, poor in contrast, and large in noise to perform image preprocessing, including filtering techniques in the spatial domain and grayscale transformation for image enhancement. Because the traditional median filter is affected by the size of the filter window is larger, the details of the processed image become blurred. Through an improved weighted median filtering algorithm, the quality of the processed image is analyzed according to the grayscale histogram and the spectrogram. The results show that the filtering speed and quality are It greatly exceeds the traditional median filter, which significantly improves the protection ability of PCB board image traces, components and other edges, and the overall image outline. Through grayscale transformation, the details of the image become clearer, and the recognition rate of the PCB board image is improved. post-processing.