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 Technical

PCB Technical - Research and Realization of PCB Image Preprocessing

PCB Technical

PCB Technical - Research and Realization of PCB Image Preprocessing

Research and Realization of PCB Image Preprocessing

2021-11-02
View:493
Author:Downs

MATLAB image enhancement processing

MATLAB supports 5 image types including indexed images, grayscale images, binary images, RGB images, and multi-frame image arrays; the collected PCB images can be first enhanced in contrast and then denoised. If this method is used, the image The original noise is also greatly increased in the process of enhancing the contrast, so that the subsequent image denoising processing can not get very good results.

Therefore, this article uses the image to denoise first and then enhance it. On the PCB image acquired, there may be noise that needs to be denoised, the light source intensity is not enough, the image may be dark as a whole, first use the RGB2GRAY function to convert the collected picture into a grayscale image (256 colors), the PCB image containing salt and pepper noise is compared with the method proposed in this article and the traditional median filtering method, and the PCB image is enhanced by gray scale transformation after denoising.

pcb board

It can be seen that for PCB images with salt and pepper noise, the traditional 3*3 median filter has a good effect on the noise of isolated points, but the traces and components on the PCB image are obviously blurred, and the image details are not of good quality. Achieve very good results. The simulation image of fast weighted median filtering of PCB images with salt and pepper noise has obvious denoising effects, and the filtering speed has also been improved. The details of the image and the traces can be well maintained.

The grayscale histogram of PCB image before and after denoising processing, the abscissa in the figure is the gray level, and the ordinate is the number of pixels corresponding to each gray level. Among them, the pixel value of 255 is salt and pepper noise. Comparing the two images, it is obvious that the two filtering methods can remove the noise very well, but the median filter filters out many gray levels, such as 150-200 The gray level makes the boundary blurred, and the peaks and valleys are destroyed. Weighted median filtering can overcome these shortcomings. The gray level and gray dynamic range can be well preserved, and the positions of the peaks and valleys are well preserved. They are all well preserved, so many details of the image can be seen clearly, in order to better facilitate the analysis.

1 picture is the frequency spectrum obtained by Fourier transform, in order to facilitate analysis, according to the periodicity of Fourier transform, the zero frequency is shifted to the middle.

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 (the 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 high-frequency information. Similarly, the gray level of noise changes rapidly, which 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, but the low-frequency components, that is, the part where the gray level changes smoothly-the contour information of the image is affected. Damage. From the histogram, it can also be seen that the slowly changing 150-200 gray levels have been destroyed, and the weighted median value can well protect the contour information, in order to make the details more prominent and the enhanced image.

From the grayscale processed histogram, it can be seen 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. There is a greater visual contrast in the image., Make the details more prominent.

2 Conclusion

This article mainly preprocesses the collected PCB images that are dark, poor in contrast, and large in noise, mainly including spatial filtering techniques and image enhancement grayscale transformation. Because the traditional median filtering is more affected by the filter window size After processing, 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 gray histogram and spectrogram. The results show that the filtering speed and quality are greatly improved. Exceeding traditional median filtering, it significantly improves the protection of PCB image traces, components and other edges, and the overall image outline. Finally, the grayscale transformation makes the image details clearer and improves the recognition rate of PCB images. deal with.