The visual inspection system based on image recognition typically includes image acquisition, data communication, image processing and reject device etc. Cigarette packet with defect seal was detected online by the visual inspection system, which can effectively detect and remove the cigarette packet with substandard seal paste, and improve the efficiency of online production. Image recognition is the core part of visual inspection system, and its effect is directly affecting the result of judgment. Therefore, it is very important to research in the field of image processing algorithm.First, the cigarette packet image was preprocessed by image segmentation to separate the packet image from the background, then template matching method was used to locate the packet seal area, meanwhile, in order to reduce the matching time, an error evaluation function was added to the original template matching method, the selecting of error evaluation threshold value should ensure the matching accuracy.Secondly, due to the image acquisition background, light, machine vibration and other unfavorable factors, the obtained images are usually very blur and difficult to identification. Image filtering can effectively suppress random interference, which will make it easier to realize the subsequent image processing, and increase the accuracy of image recognition and judgment.Next, processing the filtered image of packet seal with edge detection method, Sobel operator method shows good detection effect compared with a variety of edge detection algorithm. In order to improve the detection accuracy of sobel operator method, a further improvement was proposed in this paper. Experiments show that the improved sobel operator edge detection method is better than other edge detection methods, it can highlight the obvious edge and filter out inconspicuous edge.Finally, the seal image is processed by Radon transform. Then according to detecting the angle and position of the characteristic straight line to determine whether the seal is qualified. Based on the proposed method, a cigarette packet seal detection system has been developed. This detection system is running fast and easy to implement. The long term application in Anhui Fuyang cigarette factory of China Tobacco has verified the feasibility and effectiveness of the developed system. |