This is probably late, but I just thought about this, and came up with something worth trying.
Define a set of shapes, each parameterized with a small number of parameters. For example, define a circle through it's middle point (two variables) and a radius (third variable), a line through two end points (four variables), an arrow as a line with additional parameter for the size of the head, and so on.
Now you can transform this into a minimization problem. For each point i
on the path and each shape, determine the minimal distance to the shape as a function of the shape parameters, di(params)
. Now define a probability function that tells you how much the path looks like the shape. The default candidate is what is called "chi squared" in probability theory:
chi^2 (params) = sum_i ( di(params) )^2
The chi^2
is a function of the parameters for each shape - therefore the next step is to minimize this quantity. Libraries are available for this usually, but a minimization routine can also be implemented by hand.
After minimizing the chi^2
for each shape, the shape that gets the smallest chi^2
is the one that resembles the path most. And you already have the parameters that fit best!
Now, getting this to work properly is hard and will take a lot of time and tweaking (finding more suitable probability functions, efficient minimization routines, a good set of base shapes, etc). Google finds much more detailed explanations - but this is how I would start if no other information was available.