Professional PCB manufacturing and assembly
Building 6, Zone 3, Yuekang Road,Bao'an District, Shenzhen, China
+86-13923401642Mon.-Sat.08:00-20:00
PCB Design
PCB Design
Research and Implementation of Image Preprocessing Based on PCB
08Nov
Boy 0 Comments

Research and Implementation of Image Preprocessing Based on PCB

Research and Implementation of Image Preprocessing Based on PCB
In order to improve the image quality of PCB and further improve the recognition rate of PCB image, the original image is preprocessed with MATLAB language, mainly including gray scale transformation in image space domain and image smoothing filtering to remove noise First, noise threshold, median filtering and fast median filtering are studied, and a fast weighted median filtering algorithm is proposed The image is processed by MATLAB, and the gray strip chart and spectrum chart are compared and analyzed The results show that a fast weighted median filter is used The filtering algorithm solves the problem of poor contrast, high noise and blurry details of PCB image, which greatly improves the image quality In the information industry, this PCB is an indispensable pillar As the basic component of various electronic products and the information carrier integrating various electronic components, this PCB is rapidly developing towards high-performance, high-speed, light, thin, short and small, Its technology and complexity have reached a very high level Therefore, with the PCB field, the importance of PCB is also being further added During sampling, quantization, and transmission process of grayscale image to be measured on PCB, sensor noise of the charge coupled device (CCD, Charge Coupled Device) camera itself, and analytical digital acquisition (AD, Analog to Digital) process quantization noise, particle noise generated in photosensitive process, and slight jitter caused by human factors, etc, The image obtained during transmission and reception is inevitably affected by internal equipment and external environment, thus distorting the image quality, The signal-to-noise ratio is reduced In order to reduce noise, the smoothing filter can be used to filter the image to be tested. However, selecting a smoothing filter of different sizes will blur the processed image to varying degrees Therefore, to improve the image quality, the filter used can not only effectively remove noise, but also maintain the original appearance of the image as much as possible
Printed circuit board


pcb board


1. Image enhancement
Image enhancement is a technology to improve image quality.  Compared with image recognition preprocessing, it can be divided into two categories: spatial domain processing and frequency domain processing according to different image enhancement processing spaces The former includes the gray effect of the image And bar graph correction, both directly deal with the gray value of points; 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 transform is performed Leaf transform to obtain the desired image results Due to external exposure and other interference factors during channel transmission, the collected PCB image reduces the brightness of the image and adds noise In order to effectively eliminate noise interference and enhance the light and dark contrast of the image, this paper will use the PCB board In image enhancement, gray transformation and image smoothing of selected spatial domain are performed
1.1 Grayscale transformation in spatial domain
As an important means of image enhancement, gray scale transformation can increase the dynamic range of the image, expand the contrast of the image, make the image features more obvious, and improve the image display effect Gray level 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 Linear transformation can stretch the gray level of each point of the blurred image linearly, which can effectively improve the visual effect of the image In order to improve the post-processing and feature selection of image recognition, the original PCB first performs binary grayscale processing on the image, and then uses the image domain method of strip chart correction technology 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 spatial domain, neighborhood averaging can be used to reduce noise; In the frequency domain, due to the higher probability of noise spectrum in the high frequency band, various forms of low-pass filtering can be used In spatial domain, image smoothing mainly includes noise threshold, neighborhood average, weighted average, median filtering, etc
1) Noise threshold
The noise threshold method is a common noise removal method When it smoothes the image, this is the threshold setting The threshold setting directly affects the filtering effect and image details Then, according to the characteristics of the image, each point is detected in turn, and the values of all points in its neighborhood are based on the formula Compare and judge whether the points are noise If it is not noise, output the original value of the points. If it is noise, output is the average gray value of other points in the neighborhood The selection of threshold T is very important in this method If T is too large or too small, it will more or less lead to insufficient noise smoothing or blurred image
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 get 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 obtained first Take the median of each line, and then take the median of the median of each leveling line as the output of the filter
2) Fast weighted median filter
In order to solve the interference between noise reduction and protection of image details, a fast weighted median filtering algorithm is proposed in this paper By weight, the proportion of center points in the window is added Input: I1 I2,,, IN), output weighted median filter: r represents weight, MED {} represents median operation function, and specifications that W=(1, 1, 1) is the standard window Stipulation: where T is the threshold function, when W is an integer, 1 1 {the number of weighted output components in WrI, 2} NNW-rI-W-rI: the operation process of median operation of fast weighted median filter is: first, rank the cN number in the weighted output by ascending power, and the T number of the sorted cN number 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 can enhance the image with contrast and then denoise In the process of contrast enhancement, the original noise of the image is also greatly increased, so that the subsequent image denoising can not achieve good results Therefore, in this paper, the image is denoised first, and then enhanced In the collected PCB image, there may be noise that needs to be removed. The light source intensity is not enough, and the overall image may be dark 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 medium filtering method for the PCB image containing salt and pepper noise After de-noising, grayscale transformation is used to enhance 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 image belongs to high-frequency information Similarly, the grayscale of noise changes rapidly and is also 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. However, the low frequency components, that is, the parts with gentle gray changes, affect the image contour information It can also be seen from the bar graph that the slowly changing grayscale of 150-200 has been destroyed, and the weighted median can well protect the contour information It can be seen from the bar graph after grayscale processing that the bar graph occupies the allowable range of the whole image grayscale value, which increases the dynamic range of image grayscale, improves the contrast of the image, and has greater visual contrast in the image Make the details more prominent
3. Conclusion
In this paper, the collected PCB board image is usually dark, with poor contrast and large noise. Image preprocessing is required, including spatial filtering technology and gray scale transformation for image enhancement Because the traditional median filter is greatly affected by the size of the filtering window, the processed image details become blurred Through the improved weighted median filtering algorithm, the processed image quality is analyzed according to the gray-scale strip graph and spectrum graph The results show that the filtering speed and quality of the filter greatly exceed the traditional median filter, which significantly improves PCB image tracking, component and other edges, and overall image contour Through grayscale transformation, the details of the image become clearer and the PCB image is improved Post treatment

Just upload Gerber files, BOM files and design files, and the KINGFORD team will provide a complete quotation within 24h.