1

I have a set of hiragana characters and I want to count the numbers of strokes.

My input images are like:

character ma:

enter image description here

character ku:

enter image description here

The output would be the number of strokes, for example the character ma would return 3 strokes:

enter image description here

and the character ku would return 1 stroke:

enter image description here

I have tried Canny, Hough and Skeletonization. It didn't give me what I wanted.

I'm thinking of counting continuous lines but I don't know how. I found this answered question that finds the discontinuity of a circle here but it only applies on circles


*[The images are declared as a Mat. I am using C++, Visual Studio 2013, gcc 4.8.3 and opencv 2.4.9.]

Thank you in advance.

Community
  • 1
  • 1
R.A.
  • 101
  • 7
  • So this problem has a few parts. One is getting the lines, and the second is processing them to figure out the number of strokes. In what way has "Canny, Hough, and Skeletonization" failed in getting the number of lines (or decomposing the image into a set of lines)? – mprat May 17 '15 at 19:31
  • @mprat I guess I just couldn't get the right combination of parameters for Canny, Hough, and Skeletonization that these didn't give me the results I wanted. I'm still open on using these though. – R.A. May 18 '15 at 16:45

1 Answers1

0

Obviously, there is no one answer to this question. However, there are a few heuristics that you could use.

One option, is to detect and count the number s of stroke tips. The number of strokes would be approximated by ceil(s/2).

  • If s is even, this is a plausible approximation.
  • If s is odd, you'll have to figure out what it means for your application.

Of course, letters like A have just 2 tips, with a second inner line. If this also happens in Hiragana, you'll have to look for junctions and figure out your heuristics from there.

Adi Shavit
  • 16,743
  • 5
  • 67
  • 137