This is quite big what you're trying to do for a so question I think but here's some points I would determine to start working on such a thing:
You will have to determine many parameters to similarity like for example:
- How much can 2 lines drift from one another (like in the w you drew, the last stroke is a bit wider, so whats too wide)
- Does size matter ? Are w and W the same ?
- Does the place of the drawing matters ? Does w in top left corner and w in bottom right corner constitute a similar image ? How much distance is allowed between two similar drawings.
- How much difference is allowed, is ABCDEFGHI similar to ABCDEFGH
- Does the opasity matters ? Is hello the same as hello ? Seems like from your drawing you're assuming hello is similar to hello.
- Does the shape matters ? Is hello in vertical similar to hello in horizontal ?
I would have an approach with these steps:
- Identify a start to the 2 drawings (maybe start from an extreme left and identify one or multiple independent drawings e.g. many little circles thrown around)
- Move accordingly and keep an entity representing the difference between the two drawings with the points mentioned above.
Your core work is the move and comparing engine, the comparaison is on the part of the drawing on same "direction". This could present an issue when comparing circular shapes. But you can switch what you compare when the change of direction is higher than a certain degree (like more than 30 degrees would take you out of that shape and move to compare next one).
Also gotta think on the situation where there are multiple exits routes to the drawing, so you ll have to start another compare thread and at the same time keep an entity representing what was already passed through to not go into an infinite loop.
So morale of the story, this is big and there's no straight forward easy api to do that for you :).