Print defect detection method based on a flexible template registration

A method of detecting, the method based on a flexible template printing defects registration rigid registration initial position, general similarity measure and coordinate all the pixel level difference and rigid training samples after initial registration as a standard image optimization goals, and seek training samples to the flexible standard image registration image, and then through a flexible learning after registration training sample set, to obtain a high and low value of the template image template image, the final image to be detected is determined separately for each pixel gray and / or color is out of range of the high and low values ​​of the template, thereby obtaining a defect image. The present invention ensure that the image detection accuracy while maintaining the deformation of unstable factors such as the ability to tolerate not only reduces the probability of false positives machine vision inspection, but also reduces the risk of leakage of waste, to improve the detection accuracy of great help.