I am currently facing a fairly common problem that is fairly easy to solve, but so far all my views have failed, so I am turning to you for help.
I think the problem is better explained by some illustrations. I have several templates like these two:


I also have an image like (probably better, because the photo from which it arose was rather poorly lit):

(Note how the template was scaled to fit the image size)
The ultimate goal is a tool that determines whether the user is pointing the thumb up / down, as well as some angles between them. Therefore, I want to compare the patterns with the image and see which one is most similar to the image (or, more precisely, the angle that the hand shows). I know the direction the thumb is pointing in the template, so if I find a template that looks the same, I also have an angle.
I work with OpenCV (with Python Bindings) and have already tried cvMatchTemplate and MatchShapes, but so far it does not work reliably.
I can only guess why MatchTemplate failed, but I think that a smaller picture with a smaller white fits completely into the white area of the image, thereby creating the best match rate, although it is obvious that they really do not look the same.
Are there any methods hidden in OpenCV that I have not yet found, or is there a well-known algorithm for those kinds of problems that I have to override?
Happy New Year.
source share