Matching of contours