algorithm - Calculating similarity between drawn lines -


i need algorithm calculate, numerically, degree of similarity between 2 drawn lines. lines drawn using mouse, , stored set of cartesian coordinates before being filtered , smoothed using separate algorithms.

for example, within following diagram: diagram

lines , b similar, b , c not. algorithm should reflect this. additionally, 'direction' of line, indicated start , end points, matters. such algorithm exist?

a naive approach can taking sum of distances between corresponding points on 2 lines.so lets assume both of lines of same length , number of points on lines approximately same , equidistant.
1.translate line 2 start point same line 1's starting point.
2. calculate sum of distances between corresponding points between line 1 , line2.
3. if average distance (i.e. sum/number_of_points) lesser threshold lines similar otherwise different.
can extended support lines different sizes. in case, enlarge smaller line match longer line, rest can similar above approach.
apart calculating distance can calculate difference of slopes of lines , if different in slopes @ point (or few points, need experiment this) way high (above threshold) not similar.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -