Removing patterns interfering with the pattern to be recognised, such as ruled lines, underlines