Extraction of features or characteristics of the image by coding the contour of the pattern {using gradient analysis}