Research on Automatic Detection System of Drawing Defects based on
Machine Vision
Authors: Pan Yupeng , Chen Li , Xin Baogeng , liu Yong 
Published: September 2023

Background:
For a long time, product packaging has been used as an instruction manual to connect consumers and factories. Product packaging is an important column in product image display and information presentation. However, missing prints, misprints, and surface stains during the manufacture of packaging bags will cause consumers to misunderstand product information. Based on machine vision, image processing technology, and Python language, this paper designs an automatic detection system for paper defects. Through the preprocessing of the image of the paper to be tested, after the paper area is extracted and compared with the standard template paper, the defective parts of the paper to be tested relative to the standard template paper can be quickly and accurately obtained. The system has a single drawing detection time of 2~3 seconds, and the measurement accuracy rate reaches 100%. The results show that the system has high measurement accuracy, high measurement precision, fast measurement speed, strong adaptability to the environment, and can meet the requirements of detecting defective paper.

Objective:
The purpose of this study is to develop an automatic detection system for packaging paper, which can detect all defective parts of defective paper compared with standard paper templates. This study aims to reduce the misprints or stains that may occur when producing high-volume bags. The system optimizes and controls the detection accuracy, detection time, detection accuracy and detection environment to ensure that the system can meet the real detection requirements.

Method:
First, the accompanying software of this system is used to import the standard template of the inspection paper and use the industrial camera to obtain the original image of the inspection drawing. Then, a series of necessary processing is performed on the image: grayscale, Gaussian filter, median filter, binarization, edge detection, contour detection, and the paper area covered with the image is extracted through inverse perspective transformation. Secondly, divide the picture into several blocks and measure the translation matrix of each block to achieve translation fine-tuning to achieve higher detection accuracy. Then, the defect mask is obtained by comparing it with the standard template, and the mask is fine-tuned and processed by the strong noise reduction algorithm. After median filtering, binarization, erosion, marking and other operations are performed to realize the final defect area finding and marking. Finally, all defective areas will be displayed in the designated area of the included software.

Results:
The detection accuracy rate of this system for the defect area reaches 100%, the minimum range of the recognition area reaches 1mm (2 pixels), the light intensity of the detection environment can adapt to 50 gray levels compared with the template, and the detection of a single drawing only takes 2 ~3 seconds, indicating the high detection efficiency of the system. A patent application for the system has already begun.

Conclusion:
The system has strong adaptability to the light intensity range of the testing environment, and the minimum testing area can meet the requirements of most production drawings. The accuracy of identifying the defect area of the testing drawings shows that the system can complete the testing task well when the testing environment is suitable.