title: Counting the pips on dice using OpenCV
body: <p>I am doing a dice value recognition hobby project that I want to run on a Raspberry Pi. For now, I am just learning OpenCV as that seems like the hardest thing for me. I have gotten this far, where I have dilated, eroded and canny filtered out the dice. This has given me a hierarchy of contours. The image shows the bounding rectangles for the parent contours:</p>
  
  <p><img src="https://i.stack.imgur.com/NyHEo.png" alt="enter image description here"></p>
  
  <p>My question is: how would I proceed to count the pips? Is it better to do some template matching for face values, or should I mathematically test if a pip is in a valid position within the bounding box?</p>