| Modern printing industry increasingly stringent requirements on the quality of label printing,print defects detection link is essential.This thesis focuses on the technology of machine vision inspection and its application in the field of quality inspection of printed matter.In the process of the label image acquisition,the position of the label is different,which results in the linear transformation caused by the translation and rotation between the image to be measured and the template image.On the other hand,the thesis deformation,lens distortion and other factors will result in non-linear transformation of the image.In addition,the defective information is not all retained lead to undetected.In order to solve the above three problems,this thesis studies the algorithm of image registration and defect detection.The main work is summarized as follows:Firstly,an image registration algorithm based on phase correlation and SURF feature matching is proposed to solve the problem of linear transformation in the image.As the English label text content is composed of 26 English letters,so there are many similar feature points.If the registration algorithm based on image feature is used directly,it will lead to mismatch.Therefore,in this thesis,global linear registration based on phase correlation of image gray is used to reduce the searching range of registration algorithm based on image feature,and then,limiting the search area of feature matching,using SURF feature matching method to optimize the global linear registration.Secondly,an image registration algorithm based on Farneback optical flow method is proposed to solve the nonlinear transformation problem in image.First of all,polynomial expansion is performed on the image to be measured and the template image.With each pixel as the center,the pixel value is approximated by using a quadratic polynomial based on its neighborhood pixels,then matching the polynomial coefficients of the measured image and the template image pixel by pixel to estimate the optical flow displacement.Finally,the non-linear registration of small neighborhood detail is performed by using bilinear interpolation method according to the optical flow displacement.Thirdly,a defect detection algorithm based on difference method is proposed.First of all,analysis and comparison of three kinds of typical defect detection algorithms,which are difference method,layer detection method and Pyramid layer detection method,and a differential algorithm with fast detection speed and capable of retaining all defect information is selected.Then,the difference map is segmented by threshold,and the defective region is separated from the background.Finally,morphological processing is used to eliminate the noise and interference in the binary image and to merge the adjacent objects to realize the automatic detection of the label defects.The simulation results show that the defect detection can be carried out for the labels which are lack of texture features or repeated appearance of the same features,which verifies the feasibility and robustness of the algorithm,and has certain reference significance for the development of defect detection technology of printed matter. |