title: Shape/Pattern Matching Approach in Computer Vision
body: <p>I am currently facing a, in my opinion, rather common problem which should be quite easy to solve but so far all my approached have failed so I am turning to you for help.</p>
  
  <p>I think the problem is explained best with some illustrations. I have some Patterns like these two:</p>
  
  <p><img src="https://i.stack.imgur.com/ZjRgp.jpg" alt="Pattern 1">
  <img src="https://i.stack.imgur.com/qO45O.jpg" alt="Pattern 3"></p>
  
  <p>I also  have an Image like (probably better, because the photo this one originated from was quite poorly lit) this:</p>
  
  <p><img src="https://i.stack.imgur.com/YnJOa.jpg" alt="Picture"></p>
  
  <p>(Note how the Template was scaled to kinda fit the size of the image)</p>
  
  <p>The ultimate goal is a tool which  determines whether the user shows a thumb up/thumbs down gesture and also some angles in between. So I want to match the patterns against the image and see which one resembles the picture the most (or to be more precise, the angle the hand is showing). I know the direction in which the thumb is showing in the pattern, so if i find the pattern which looks identical I also have the angle. </p>
  
  <p>I am working with OpenCV (with Python Bindings) and already tried cvMatchTemplate and MatchShapes but so far its not really working reliably.</p>
  
  <p>I can only guess why MatchTemplate failed but I think that a smaller pattern with a smaller white are fits fully into the white area of a picture thus creating the best matching factor although its obvious that they dont really look the same.</p>
  
  <p>Are there some Methods hidden in OpenCV I havent found yet or is there a known algorithm for those kinds of problem I should reimplement?</p>
  
  <p>Happy New Year.</p>