I am working on a project in which I have a function in the image, described as a set of X and Y coordinates (5-10 points for each function) that are unique to this function. I also have a database with thousands of functions, each of which has the same type of descriptor. The result is as follows:
myFeature: (x1,y1), (x2,y2), (x3,y3)... myDatabase: Feature1: (x1,y1), (x2,y2), (x3,y3)... Feature2: (x1,y1), (x2,y2), (x3,y3)... Feature3: (x1,y1), (x2,y2), (x3,y3)... ...
I want to find the best match for myFeature in myDatabase functions.
What is the fastest way to map these functions? Currently, I step every function into the database and compare every single point:
bestScore = 0 for each feature in myDatabase: score = 0 for each point descriptor in MyFeature: find minimum distance from the current point to the... points describing the current feature in the database if the distance < threshold: there is a match to the current point in the target feature score += 1 if score > bestScore: save feature as new best match
This search works, but it clearly painfully slows down in large databases. Does anyone know a faster method for this type of search, or at least if there is a way to quickly exclude functions that obviously won't match the handle?