In this paper we introduce a novel algorithm for automatic fault detection in textures. We study the problem of finding a defect in regularly textured images with an approach based on a template matching principle.We aim at registering patches of an input image in a defect-free reference sample according to some admissible transformations. This approach becomes feasible by introducing the so-called discrepancy norm as fitness function which shows particular behavior like a monotonicity and a Lipschitz property. The proposed approach relies only on few parameters which makes it an easily adaptable algorithm for industrial applications and, above all, it avoids complex tuning of configuration parameters.Experiments demonstrate the feasibility and the reliability of the proposed algorithms with textures from real-world applications in the context of quality inspection of woven textiles.