Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • @Frank, thanks for your advice. Could you give me some example code in Python? PIL's build-in histogram() function returns a list, how to determine how close two images' histograms are? Commented Nov 10, 2009 at 0:18
  • @Frank, looks like it requires 10,000 distance calculations when picking images with similar histogram out of 10,000 candidates? is it possible to associate numeric values with each image and store them in database thus comparison can be simplified to some sql queries? Commented Nov 10, 2009 at 1:55
  • @jack, 10,000 calcs isn't really that expensive. The best way to speed up code like this is not to reduce the histograms into integers (which can't be done the way you think) but to simply cache the results. Cache the sort order (per image) in the database or cache it in memory. Make sure you also store the histogram in the database or in memory so that rebuilding those sort order caches isn't expensive. Commented Nov 10, 2009 at 2:07