A method of comparing two patterns independent of possible transformations and small distortions