title: Pairing up color names and values
body: <p>I am working on extracting information from figures in scientific papers, combining image processing on the figure itself and natural language processing on its caption.</p>
  
  <p>I have got to a stage where I have isolated objects within the image, and got an "average" colour for each (in both RGB and Lab colorspaces, not sure what's best yet). From the caption, I have parsed a list of objects, along with the color name used to describe them.</p>
  
  <p>So I have two lists:</p>
  
  <pre><code>names = ['Red', 'Brown', 'Yellow', 'Magenta'];
  rgbs = [ (249,0,252), (253,0,1), (250,248,60), (140,70,20)];
  </code></pre>
  
  <p>I'm trying to figure out an automated method of determining the best pairings between the names and values. Thinking about it, I think it might be best to start by using a lookup table for all common names to convert the names into their "accepted" rgb values. Then I can work out the "distance" (Euclidean?) between each of the rgb values and each of the name rgbs. At this stage somehow I should be able to use those distances to find the optimum pairings, but I'm not sure exactly how.</p>
  
  <p>Does anyone have any ideas, or know of any libraries that might provide useful tools for this? </p>