I have been looking through the OpenCV documentation and I cant find any mention of the cv::matchShapes return value. There seem to be three methods cv::CONTOURS_MATCH_I1, cv::CONTOURS_MATCH_I2, cv::CONTOURS_MATCH_I3. They are a sum of distances so I guess a perfect match is 0 however what is the possible value range (maybe its not possible to give this - but cv::CONTOURS_MATCH_I3 seems to normalise?). In either case the documentation should give information on at least the fact that a perfect match has a result of zero.