Project overview
In the printing process, due to technological and other reasons, printed materials often have poor color and inaccurate overprinting, as well as appearance defects such as defective spots, ink lines, and black leather, which lead to the appearance of defective printing products.Printing companies generally use manual methods to sort defective products by sampling during printing and visual inspection one by one after printing. The detection efficiency is low, the cost is high, and the labor intensity is high.Practice has proved that the use of machine vision systems to replace humans for print defect detection can improve production efficiency and reduce production costs.This paper discusses the use of PC-based machine vision system instead of manual print inspection, and uses the characteristics of high computer accuracy and fast speed to quickly and accurately detect the appearance defects of printed materials, and comprehensively analyze the degree of defects to determine whether the printed materials are defective or scrap.
Image acquisition and preprocessing
Used in this system: image capture card, CCD camera, IPC, image processing software. During the image acquisition process, due to the influence of camera accuracy, lighting environment and other factors, there will be a certain amount of random noise in the collected image, resulting in image distortion.Here, a weighted median filtering algorithm that can remove sharp-edge interference while maintaining edge details is used.Determine a window W with an odd number of pixels, first weight each pixel in the window, and the weighting value of a certain pixel is m, that is, when the grayscale of the window pixel is queued, the pixel is repeated m times, and then arrange the cells in the window according to the gray value from large to small, and then use the gray value in the middle position instead of the intermediate value of the original image f (x, y) to obtain an enhanced image g (x, y).
Visual inspection
(1) Defect detection
Printing defects are manifested in the image, that is, the difference between the grayscale value at the defect of the collected image and the standard image.The gray value of the collected image is differentiated from the standard image (the pixel value is subtracted), and it is determined whether the difference (the degree of difference between the grayscale values of the two images) exceeds the pre-set standard value range, and it can be determined whether the print is defective or not.
(2) Defect identification
After the difference is completed, a difference map of the same size as the acquired image is obtained, and its pixel value is the difference between the corresponding pixels of each two images.Subsequently, the differential image is scanned line by line to detect defect points.When a defective pixel is encountered (its value is >0), the entire defective area is traversed recursively, and the size and size of the defective area are recorded at the same time.After the entire scanning process is completed, the number of recursions is the number of defects. In the defect recognition process, there will be two or more defect areas that are very close to each other (for example, two defect points are only one pixel away from each other on the image). It is usually considered that they belong to the same defect area. Therefore, they need to be combined into one defect area before detection.The expansion algorithm of mathematical morphology is used here.After a series of operations such as corrosion, expansion, and re-corrosion, the edge shape of the defective image is extracted for further analysis and judgment.
Experimental results
The printed images collected in the static mode were tested, and the experimental results showed that the above method was effective, and the simulated defects could be completely detected, and the expected purpose was achieved.
Previous:no more!