title: Font matching using image moments in OpenCV
body: <p>I am creating a code which will tell me how similar two letters are to each other.
  For this, I decided to go with <code>HuMoments</code> concept in OpenCV. </p>
  
  <p>Given are the images that I have</p>
  
  <p>Co.jpg
  <a href="https://i.stack.imgur.com/bx0rF.jpg" rel="nofollow noreferrer">C0.jpg</a></p>
  
  <p>A.jpg
  <a href="https://i.stack.imgur.com/h9ySW.jpg" rel="nofollow noreferrer">A.jpg</a></p>
  
  <p>Colorado.jpg
  <a href="https://i.stack.imgur.com/7xom8.jpg" rel="nofollow noreferrer">Colorado.jpg</a></p>
  
  <p>I am reading the images using:</p>
  
  <pre><code>im5 = cv2.imread("images/C0.jpg",cv2.IMREAD_GRAYSCALE)
  im7 = cv2.imread("images/Colorado.jpg",cv2.IMREAD_GRAYSCALE)
  im9 = cv2.imread("images/A.jpg",cv2.IMREAD_GRAYSCALE)
  </code></pre>
  
  <p>I am using <code>cv2.matchShapes</code> attribute to match:</p>
  
  <pre><code>m6 = cv2.matchShapes(im5, im7, cv2.CONTOURS_MATCH_I2,0)
  m8 = cv2.matchShapes(im5, im9, cv2.CONTOURS_MATCH_I2,0)
  </code></pre>
  
  <p>Finally I am printing the output:</p>
  
  <pre><code>print("C0.png and Colorado.png : {}".format(m6))
  print("C0.png and A.jpg : {}".format(m8))
  </code></pre>
  
  <p>Here the value closest to zero (0) means perfect match</p>
  
  <p>My output:</p>
  
  <pre><code>$ python3 shapeMatcher.py 
  Shape Distances Between 
  -------------------------
  C0.png and Colorado.png : 0.10518804385516889
  C0.png and A.jpg : 0.0034705987357361856
  </code></pre>
  
  <p>C0 and Colorado are mismatches which is displayed correctly. The one thing that's baffling me is how is C0.jpg and A.jpg a close match? Am I missing something, what's an alternate way to get a mismatch between C0 and A? Please note value closer to zero means closest match.</p>