Ask Your Question

Revision history [back]

Here is a small approach I will use in your case:

  1. Find octagon by template matching (doc). Use an empty octagon for template.
  2. subtract the empty octagon for each founded => you have ``only'' the lines made by user (and some noise remove with a threshold on white value, may be convert the image in HSV before doing the subtraction with cvtColor.
  3. In the binary mask coming from subtraction, count the pixels along all potential lines (1-2,1-3,...) using an acceptable width, ie: count not only for a line of one pixel, but for 5 or 6 thick. If the value is high (to determine by samples...) => you have a connection between numbers.

To avoid problem when you count a pixel for a line, remove it from the mask if the line is accepted.

If the line are too thin, try morphological maths to emphasized it with this.

Let us know if it working.