Stroke recognition
Recently I did this little stroke recognition experiment. At some point I’ll probably use it in a game.
- Draw strokes and add them with the + button
- Draw a new Stoke and will be matched against the samples (marked red on the top row)
The actual recognition matcher is actually pretty simple. The only prerequisite is that if had to be size invariant, that is, tt should not take into account the scale. I ended up with a pretty simple approach. I normalize both strokes to compare them and just check the dot products of each segments. That is exactly the same as if we were checking their polar coordinates.
In this way we always need to draw the shape using the same starting and ending point. I actually wanted this behaviour but if you want to make it just detect the final shape regarless of the starting and end points you could use something like cross correlation.