In order to improve product quality and production efficiency,machine vision has been applied to the production line of various products to detect product defects.At present,in the production process of transparent meal box,some defects will inevitably appear in the product.These defects seriously affect the overall quality of meal box products and reduce the competitiveness of the factory.In order to reduce the cost of manual defect detection and improve the accuracy and efficiency of detection,this paper studies the defect detection technology of the transparent meal box and designs a set of defect detection program.The main researches of the thesis are as follows:(1)A defect detection system for transparent meal box was designed.According to the testing requirements,a 2-mega-pixel CMOS black-and-white industrial camera was adopted,and a suitable 12mm industrial lens with focal length was selected.In addition,according to the characteristics and experimental verification of the box,an appropriate surface light source was selected to improve the image contrast while preventing the meal box from reflecting light.(2)The traditional Canny algorithm is improved effectively.The algorithm uses mathematical morphological dilation and mean filtering to denoise.By adding Sobel gradient templates in 45° and 135° directions,the gradient information can be obtained more effectively.To automatically select the high and low thresholds of Canny algorithm,the adaptive threshold algorithm based on gray median and threshold correction coefficient is adopted.The experimental results show that the accuracy and anti-interference ability of the improved Canny algorithm are improved obviously.(3)Based on the improved Canny algorithm to detect the defects of transparent meal box.For oil stains,the image denoising method is used to improve the contrast,and then the interference of background and other structural features is removed by threshold segmentation method,so oil stains can be extracted.The hole defect detection is based on the improved Canny algorithm in this paper.After the edge image is obtained,the edge of the hole is determined by the contour based circular detection.Both notch and barb will increase the pixel of the outermost edge of the meal box.Therefore,after extracting the edge with the improved Canny algorithm and extracting the outermost contour pixel,the threshold comparison can determine whether these two defects exist.(4)A defect detection program for transparent meal box was developed.Firstly,the application program of defect detection is designed,and then the algorithm of defect detection is tested and verified.According to the verification and analysis of the program on whether the meal box contains defects and the recognition effect of each defect,it is found that the recognition accuracy rate of the algorithm proposed in this paper is 97%,and the detection time of each image does not exceed 1.8s,which proves that the defect detection method proposed in this paper is accurate and fast.This paper studies the defect recognition of transparent lunch box based on machine vision.Firstly,an image acquisition system was designed,and an improved Canny edge detection algorithm was proposed.A set of defect detection program was developed and its detection efficiency was verified,which has reference value for the quality control of similar products in industrial production. |