1 | initial version |
your list looks like you're missing some pre-processing, you should binarize the grayscale images before findContours (threshold/canny or such) and filter the found contours for size (boundingRect()) to remove very small (like 1 pixel noise) contours
it might be helpful, to visualize your temporary steps, like the binary images & the contours (drawContours), in most cases you can already "see", what's wrong.
then, you need to find an (experimental) threshold value, so any result from matchShapes larger than that is considered non-matching. this depends on your data, and your processing.