The detection and recognition of the appearance defects of printed matter by Machine Vision:
In the process of printing, due to the process and other reasons, printing products often appear color difference, overprinter inaccuracy, and some appearance defects such as defect points, ink lines and black leather, which lead to the appearance of defective printing products. In general, printing enterprises adopt manual method, sampling in printing and visual inspection one by one after printing to sort out defective products, which has low detection efficiency, high cost and high labor intensity. It has been proved that the use of Machine Vision system to detect the defects of printed matter can improve the production efficiency and reduce the production cost. This paper discusses the use of PC based Machine Vision system instead of manual inspection of printed matter, using the characteristics of high accuracy and fast speed of computer, quickly and accurately detect the appearance defects of printed matter, and comprehensively analyze the degree of defects, so as to judge whether the printed matter is secondary or scrap.
1、 Image acquisition and preprocessing
The system uses: image acquisition card, CCD camera, IPC, image processing software. In the process of image acquisition, due to the influence of camera accuracy, lighting environment and other factors, there will be some random noise in the collected image, which will lead to image distortion. In this paper, a weighted median filtering algorithm is used, which can remove the sharp interference and keep the edge details. A window w with an odd number of pixels is determined. Firstly, each pixel in the window is weighted, and the weighted value of a certain pixel is m, that is, when the gray level of the window pixel is queued, the pixels in the window are repeated by m, and then the pixels in the window are arranged according to the gray level value from large to small, and the gray level value in the middle of the window is replaced by the middle value of the original image f (x, y) to get the enhanced image g (x, y).
2、 Visual inspection
（1） Defect detection
The printing defect is shown in the image, that is, the difference between the gray scale value at the defect of the collected image and the standard image. If the difference between the gray value of the collected image and the standard image (pixel value subtraction) is beyond the range of the preset standard value, the defect of the printed product can be determined.
（2） Defect identification
After the difference is completed, a difference image of the same size as the acquisition image is obtained, and its pixel value is the difference between the corresponding pixel points of each two images. Then, the difference image is scanned line by line to detect the defect points. When a defect pixel is encountered (its value is > 0), the whole defect area is traversed recursively, and the size and size of the defect area are recorded at the same time. After the whole scanning process, the number of recursion is the number of defects. In the process of defect recognition, there will be two or more defect areas which are very close to each other (for example, two defect points have only one pixel distance on the image). They are generally considered to belong to the same defect area. Therefore, they need to be combined into a defect area before detection. Here we use mathematical morphology expansion algorithm. After a series of operations such as corrosion, expansion and recorrosion, the edge shape of defect image is extracted for further analysis and judgment.
3、 Experimental results
The experimental results show that the above method is effective and can detect the simulation defects completely, and achieve the expected purpose.