I'm working on a project that involves scanning in colors to RGB then searching through a database of more RGB data to see what is most similar to the scanned in color. I've decided that the easiest way to determine what "similar" means in this case is to represent the colors in three dimensional space and then find the distance between the scanned point and the rest of the database.
It seems to me that the first part of this is fine, the idea of using 3d space and proximity, but that second half seems like a bad idea to me, I shouldn't have to check the scanned color against every single point in the database, should I? Having never done any formal CS work, I don't know what to do, but I have a terribly distinct feeling that there must be a better way.
Or, to make this abstract: I have some input data, and a bunch of stored data and a function that tells me how similar the any two data are. What is the most efficient way of finding out the most similar stored entity to the input?
Edit: I'm using python for this, if anyone's curious.